home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!van-bc!pkyn.questor.wimsey.bc.ca!ldp
- From: ldp@pkyn.questor.wimsey.bc.ca (Lyle Parkyn)
- Newsgroups: comp.sys.next.programmer
- Subject: TextField: can't change textGray and seemingly weird side effects
- Message-ID: <1992Aug15.205626.2573@pkyn.questor.wimsey.bc.ca>
- Date: Sat, 15 Aug 1992 20:56:26 GMT
- Sender: ldp@pkyn.questor.wimsey.bc.ca
- Reply-To: ldp@pkyn.questor.wimsey.bc.ca (Lyle Parkyn)
- Distribution: na
- Organization: V-NUS (Vancouver NeXT Users Society)
- Lines: 37
-
- I found I couldn't change the textGray of a Textfield programmatically. I
- eventually discovered that the following code seemed to prevent changes to
- textGray.
-
- [[[nameText setEditable:NO] setEnabled:NO] setSelectable:NO];
- [[nameText setBordered:NO] setBezeled:NO];
- [[nameText setBackgroundTransparent:YES] setBackgroundGray:NX_WHITE];
- [nameText setTextGray:NX_BLACK];
- [nameText setAlignment:NX_CENTERED];
- (where nameText is a alloc'd and initFrame'd TextField)
-
- The offending line was
- [[[nameText setEditable:NO] setEnabled:NO] setSelectable:NO];
- if I just did
- [nameText setSelectable:NO];
- then the textGray could be changed.
-
- Further reading showed that setSelectable:NO makes the text static and
- noneditable (not unexpected). Doing a setEditable:NO and setEnabled:NO before
- the setSelectable:NO, however, seems to have the side effect of permanently
- setting the textGray. I even tried the setTextGray method of TextFieldCell
- (after getting the textfields cell) without success.
-
- In the strictest sense of the word I could see that setEditable:NO might mean
- nothing about the textfield is changable, however, the text is changable which
- kind of violates that idea.
-
- I am left with the conclusion that TextField has some methods with undocumented
- and undesirable side effects. Did anyone else have similar experiences?
-
- Makes me wonder what other land mines are scattered in the Appkit.:-) I don't
- have the FAQ which possibly covers all this, in which case "Never Mind".
-
- --
- =====
- ldp@pkyn.questor.wimsey.bc.ca (Mail and/or NeXTMail )
- Lyle Parkyn - Reveal Development Service
-