Re: Updating text fields in Cocoa.
Re: Updating text fields in Cocoa.
- Subject: Re: Updating text fields in Cocoa.
- From: Daniel Todd Currie <email@hidden>
- Date: Sun, 1 Feb 2004 02:20:25 -0800
I'm not sure what qualifiers are in this context, but if the program
functions as you expect then it may be just as well to ignore this
warning. Perhaps someone else on the list will enlighten us as to the
nature of qualifiers and their implications.
For other's convenience, we are trying to pass a CFStringRef to the
setStringValue: method of NSTextField.
On 2004 Feb 01, at 02:09, email@hidden wrote:
Daniel. I tried your suggestion and while it did build, it gave the
following
warnings,
Preferences.m:114: warning: passing arg 1 of `setStringValue:' discards
qualifiers from pointer target type
Preferences.m:115: warning: passing arg 1 of `setStringValue:' discards
qualifiers from pointer target type
These are the two offending lines.
[showActive
setStringValue:CFArrayGetValueAtIndex(pairCFArrayRef, 1)];
[showSerial
setStringValue:CFArrayGetValueAtIndex(pairCFArrayRef, 2)];
In a message dated 02/01/2004 04:04:46, email@hidden writes:
It would seem that you are trying to pass the -setStringValue: method
a
C string, whereas it requires an NSString. You can probably pass it a
CFStringRef, as it is compatible ("toll-free bridged") with NSString,
thus avoiding your need for many of your objects. This may work for
your purposes:
[showActive setStringValue:CFArrayGetValueAtIndex(pairCFArrayRef,
1)];
For future reference, the '@' character is unnecessary in your code.
An NSString object might be defined as such:
NSString *someString = @"This is a string.";
However, if you were to use this string in a text field, it would be
implemented as such:
[someTextField setStringValue:someString];
The '@' character is only necessary when defining the string.
Hope this helps,
// Daniel Currie
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.