NSTextFieldDelegate issues
I have an app with six (6) text fields. I need to know when the text in any of the text fields has changed so I can process them as a group. AppDelegate .h @interface WK2CFGMacAppDelegate : NSObject NSApplicationDelegate, NSTextFieldDelegate { outlets } actions - (void) textDidChange:(NSNotification *)aNotification; AppDelegate.m -(void) awakeFromNib { [textField setDelegate:self] // for all six fields } -(void) textDidChange:(Notification *)aNotification { NSLog(@Text changed); } The textDidChange method is not being called. Any help would be appreciated. Jim JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTextFieldDelegate issues
Wow! That was easy. Thank You! Jim On Jun 17, 2011, at 9:21 AM, Alexander Reichstadt wrote: Try controlTextDidChange Am 17.06.2011 um 16:11 schrieb JAMES ROGERS: I have an app with six (6) text fields. I need to know when the text in any of the text fields has changed so I can process them as a group. AppDelegate .h @interface WK2CFGMacAppDelegate : NSObject NSApplicationDelegate, NSTextFieldDelegate { outlets } actions - (void) textDidChange:(NSNotification *)aNotification; AppDelegate.m -(void) awakeFromNib { [textField setDelegate:self] // for all six fields } -(void) textDidChange:(Notification *)aNotification { NSLog(@Text changed); } The textDidChange method is not being called. Any help would be appreciated. Jim JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/lxr%40mac.com This email sent to l...@mac.com JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Declaring and initialization of C array.
KR says to declare and initialize an array in C: int myArray[2] = {1,2}; If the above is entered into the .h file of a cocoa project, the compile will fail with the following: /Users/jimrogers_w4atk/Development/workspace/ArrayTest/ArrayTestAppDelegate.h:14:0 /Users/jimrogers_w4atk/Development/workspace/ArrayTest/ArrayTestAppDelegate.h:14: error: expected ':', ',', ';', '}' or '__attribute__' before '=' token I would really like to use a simple C array as the example above. Any help would be appreciated. JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
About menu item is greayed out.
IB Inspector indicates the item is enabled. But when I build and run the app, it is greyed out. I am new to cocoa development and have no idea where to look other than IB. JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Closing an app with the red dot.
I understand this is not the way to close an application, but once someone does use the red dot, is there a way to get the program out of the background and back on the screen? JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Closing an app with the red dot.
I am a cocoa developer, albeit a new one. So I have every right to post this question on this site. Thank you very much, but clicking on the application in the dock does not work in my case. That would be a rather obvious answer and one of the many things I tried. Based on some of the web guru sites, I am not the first to pose this question and a not willing to accept the answer I see most, that is the way Mac works. That is why I came to this site, as a last resort. You have a nice day Joanna. Jim On May 17, 2011, at 6:35 AM, Joanna Carter wrote: Jim Do you realise that this is a mailing list for software developers? Nonetheless, assuming you don't mean programatically, simply click on the application in the Dock. Joanna -- Joanna Carter Carter Consulting JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
RE:closing app with the red dot
Thanks to Nick and Pascal the issue is closed, successfully. Jim JIM ROGERS, W4ATK w4...@bellsouth.net http://web.me.com/jimrogers_w4atk K3/100 P3 K2/10 JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Closing an app with the red dot.
Joanna, No problem. I should have phrased it better. After many exchanges the simplest and best solution for this particular application came from Andy, just disable the button. I am a retired Senior Systems Analyst and certainly can be guilty of tossing a few stones at glass houses. Picking up a new language at 77 is a challenge. Very best regards, Jim On May 17, 2011, at 9:07 AM, Joanna Carter wrote: I am a cocoa developer, albeit a new one. So I have every right to post this question on this site. I think Joanna can be forgiven for an honest misunderstanding. My apologies; I also moderate other technical newsgroups and it is sometimes easy to jump to the wrong conclusion, especially when the OP doesn't mention anything to do with programming :-) Joanna -- Joanna Carter Carter Consulting ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jimrogers_w4atk%40me.com This email sent to jimrogers_w4...@me.com JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSString midstring()
I know there must be a better way but this was all I could come up with as a rookie cocoa programmer to get a substring out of a very long NSString from a textView growing as the operator types in the message content. The receive buffer in the chip I am talking to will only take 80 characters before an XOFF (buffer 2/3 full). XON occurs when the chip buffer is reduced to about 1/3 full. This routine is in a thread that reads data from the chip as well. char sndBuffer[65]; int j; characterIndex++; // is always sitting at the last character sent so advance to the next character in string. for (j = 0; j 65; j++) { sndBuffer[j] = [string characterAtIndex:characterIndex]; characterIndex++; } sndBuffer[j] = 0x00; substring = [NSString stringWithUTF8String:sndBuffer]; It works flawlessly, but there oughta be a way without reverting to C? Suggestions very much welcomed. JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSString midstring()
Quincy, I have stepped this through with the debugger and no flags were raised. The code compiles without an error or a warning of any kind. I am afraid your response has overwhelmed me. One thing I will mention, I am not changing string. So that point is a moot one. I am just copying data out of the string. The substring = [NSString stringWithUTF8String:sndBuffer] was not my own and came from a website as a result of my query on C string to NSString and it works. I appreciate your input and will study this a bit more. Jim On Apr 17, 2011, at 3:50 PM, Quincey Morris wrote: On Apr 17, 2011, at 13:09, JAMES ROGERS wrote: char sndBuffer[65]; int j; characterIndex++; // is always sitting at the last character sent so advance to the next character in string. for (j = 0; j 65; j++) { sndBuffer[j] = [string characterAtIndex:characterIndex]; characterIndex++; } sndBuffer[j] = 0x00; substring = [NSString stringWithUTF8String:sndBuffer]; It works flawlessly, but there oughta be a way without reverting to C? This code is just wrong, BTW. The return value from -[NSString characterAtIndex:] is 'unichar', which is a 16-bit quantity, so assigning it to a 'char' variable isn't a good idea. Also, the return value is *not* a character, in the sense of being a Unicode code point. It's an element of the UTF-16 representation of the string. That means you can't just stop extracting elements at an arbitrary position, without potentially breaking the current substring and/or the next substring. Either you're going to have to analyze the sequence of elements manually according to the UTF-16 definition to find a good break point, or use something like -[NSString rangeOfComposedCharacterSequence...] (which doesn't do the same thing, but does guarantees a usable UTF-16 break point). Also, re-creating the NSString (substring) using a UTF-16 string but pretending it's a UTF-8 string isn't going to work very well. Also, it matters what's going to happen to your substring next. The UTF-8, UTF-16 and Unicode code point byte-lengths of a string are all different, so your assumptions about what fits into a fixed-size buffer need to be carefully re-examined. JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSString midstring()
Mike, thanks for your response. I looked at -substringWithRange but could not discern how exactly I would apply it. I will take another look. Thanks, Jim On Apr 17, 2011, at 3:22 PM, Mike Abdullah wrote: Why not use -substringWithRange: ? On 17 Apr 2011, at 21:09, JAMES ROGERS wrote: I know there must be a better way but this was all I could come up with as a rookie cocoa programmer to get a substring out of a very long NSString from a textView growing as the operator types in the message content. The receive buffer in the chip I am talking to will only take 80 characters before an XOFF (buffer 2/3 full). XON occurs when the chip buffer is reduced to about 1/3 full. This routine is in a thread that reads data from the chip as well. char sndBuffer[65]; int j; characterIndex++; // is always sitting at the last character sent so advance to the next character in string. for (j = 0; j 65; j++) { sndBuffer[j] = [string characterAtIndex:characterIndex]; characterIndex++; } sndBuffer[j] = 0x00; substring = [NSString stringWithUTF8String:sndBuffer]; It works flawlessly, but there oughta be a way without reverting to C? Suggestions very much welcomed. JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
textField - setIntegerValue
I am feeling really stupid. I have a simple textField set up in IB, nothing else, just a window with a textField. I have connected the textField to the outlet. In appdelegate,h IBOutlet NSTextField *textField; in appdelegate.m [textField setIntegerValue:10] Nothing is displayed in the textField. In another project, I have a textField and a stepper together, when I increment/decrement using the stepper connected to the textField, the steppers value is displayed (using setIntegerValue). JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
AppDelegate does not implement the NSTextViewDelegate protocol
Everything works but I am getting the following: Warning: Class WinKeyer2AppDelegate does not implement the 'NSTextViewDelegate' protocol. code snippet: - (void) awakeFromNib{ [*textView setDelegate:self]; } - (void) textDidChange:(NSNotification *)aNotification { process string information from textView } NSTextView communicates with its delegate through methods declared both by theNSTextViewDelegate Protocol protocol and by its superclass’s protocol,NSTextDelegate Protocol. Note that all delegation messages come from the first text view. I have implemented a method from the super classe's protocol. Why am I getting the warning? Thanks for help to the newbie. JIM ROGERS jimrogers_w4...@me.com http://web.me.com/jimrogers_w4atk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com