setEditable for NSTextField
setEditable for NSTextField
- Subject: setEditable for NSTextField
- From: Chuck Soper <email@hidden>
- Date: Tue, 21 Sep 2004 12:01:47 -0700
I am trying to programmatically turn on and off editing for an
NSTextField. Calling setEditable: does turn on and off editing
properly. But, when the field is not editable I also need to prevent
the white background from drawing and having the text being initially
selected. In IB, I turned on 'Release when closed' and turned off
'One shot'.
Whenever the text field is not editable, it has a white background
and all of the text is selected.
The code below is in the action method that displays the window by
selecting a menu item. Does anyone have suggestions on how to get
this working correctly? Once I get this working I'll take out the
excessive display and update calls.
Thanks,
Chuck
NSString *theString;
if (!editableText) {
theString = @"some string";
[myTextField setEditable:FALSE];
[myTextField setBezeled:FALSE];
[myTextField setDrawsBackground:FALSE];
} else {
theString = @"";
[myTextField setEditable:TRUE];
[myTextField setBezeled:TRUE];
[myTextField setDrawsBackground:TRUE];
}
[myTextField setStringValue:theString];
[myTextField display];
[myWindow update];
[myWindow display];
[myWindow makeKeyAndOrderFront:nil];
printf("isBezeled = %s\n", [myTextField isBezeled] ? "TRUE" : "FALSE");
printf("bezelStyle = %d\n", [myTextField bezelStyle]);
printf("drawsBackground = %s\n", [myTextField drawsBackground] ?
"TRUE" : "FALSE");
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden