home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / next / programm / 5638 < prev    next >
Encoding:
Internet Message Format  |  1992-08-15  |  2.1 KB

  1. Path: sparky!uunet!van-bc!pkyn.questor.wimsey.bc.ca!ldp
  2. From: ldp@pkyn.questor.wimsey.bc.ca (Lyle Parkyn)
  3. Newsgroups: comp.sys.next.programmer
  4. Subject: TextField: can't change textGray and seemingly weird side effects
  5. Message-ID: <1992Aug15.205626.2573@pkyn.questor.wimsey.bc.ca>
  6. Date: Sat, 15 Aug 1992 20:56:26 GMT
  7. Sender: ldp@pkyn.questor.wimsey.bc.ca
  8. Reply-To: ldp@pkyn.questor.wimsey.bc.ca (Lyle Parkyn)
  9. Distribution: na
  10. Organization: V-NUS (Vancouver NeXT Users Society)
  11. Lines: 37
  12.  
  13. I found I couldn't change the textGray of a Textfield programmatically. I  
  14. eventually discovered that the following code seemed to prevent changes to  
  15. textGray.
  16.  
  17.     [[[nameText  setEditable:NO] setEnabled:NO]  setSelectable:NO];
  18.     [[nameText setBordered:NO] setBezeled:NO];    
  19.     [[nameText setBackgroundTransparent:YES] setBackgroundGray:NX_WHITE];
  20.     [nameText setTextGray:NX_BLACK];    
  21.     [nameText setAlignment:NX_CENTERED];
  22.     (where nameText is a alloc'd and initFrame'd TextField)
  23.  
  24. The offending line was
  25.     [[[nameText  setEditable:NO] setEnabled:NO] setSelectable:NO];
  26. if I just did
  27.     [nameText  setSelectable:NO];
  28. then the textGray could be changed.
  29.  
  30. Further reading showed that setSelectable:NO makes the text static and  
  31. noneditable (not unexpected). Doing a setEditable:NO and setEnabled:NO before  
  32. the setSelectable:NO, however, seems to have the side effect of permanently  
  33. setting the textGray.  I even tried the setTextGray method of TextFieldCell  
  34. (after getting the textfields cell) without success.
  35.  
  36. In the strictest sense of the word I could see that setEditable:NO might mean  
  37. nothing about the textfield is changable, however, the text is changable which  
  38. kind of violates that idea.
  39.  
  40. I am left with the conclusion that TextField has some methods with undocumented  
  41. and undesirable side effects. Did anyone else have similar experiences? 
  42.  
  43. Makes me wonder what other land mines are scattered in the Appkit.:-) I don't  
  44. have the FAQ which possibly covers all this, in which case "Never Mind".
  45.  
  46. -- 
  47. =====
  48. ldp@pkyn.questor.wimsey.bc.ca (Mail and/or NeXTMail )
  49. Lyle Parkyn - Reveal Development Service
  50.