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

  1. Path: sparky!uunet!ogicse!uwm.edu!rpi!psinntp!psinntp!afs!greg
  2. From: greg@afs.com (Gregory H. Anderson)
  3. Newsgroups: comp.sys.next.programmer
  4. Subject: Re: TextField: can't change textGray and seemingly weird side effects
  5. Message-ID: <1992Aug19.010043.820@afs.com>
  6. Date: 19 Aug 92 01:00:43 GMT
  7. Article-I.D.: afs.1992Aug19.010043.820
  8. Sender: greg@afs.com
  9. Lines: 39
  10.  
  11. Reply-To: greg@afs.com
  12.  
  13. In article <1992Aug15.205626.2573@pkyn.questor.wimsey.bc.ca>  
  14. ldp@pkyn.questor.wimsey.bc.ca (Lyle Parkyn) writes:
  15. > I found I couldn't change the textGray of a Textfield programmatically. 
  16. > I eventually discovered that the following code seemed to prevent 
  17. > changes to textGray.
  18. > [stuff deleted]
  19. > I am left with the conclusion that TextField has some methods with 
  20. > undocumented and undesirable side effects. Did anyone else have similar 
  21. > experiences? 
  22.  
  23. The only thing that tripped you up was the setEnabled: messge. All NeXT  
  24. controls respond to this method by graying themselves down in some way, to  
  25. indicate their disabled state. This is a desirable user interface clue  
  26. which would be defeated if you could subsequently change the color back  
  27. under program control. For the record, here is the hierarchy:
  28.  
  29.   setEditable: - can the text be changed?
  30.  
  31.   setSelectable: - regardless of editable state, can the text be selected  
  32. and copied with the selectText: and copy: methods?
  33.  
  34.   setEnabled: - will the control react to or send any actions? (NO always  
  35. implies setEditable:NO and setSelectable:NO)
  36.  
  37. There is a "gotcha" in the interactions of the first two methods. Sending  
  38. setEditable:NO automatically performs setSelectable:NO, which I consider a  
  39. mistake. So if you want the text to stay selectable, you must follow any  
  40. setEditable:NO with a setSelectable:YES.
  41.  
  42. --
  43. Gregory H. Anderson          | "We're very tolerant around here,
  44. Benevolent Dictator-for-Life |  being only amateurs ourselves."
  45. Anderson Financial Systems   | - Tortoise (Godel, Escher, Bach)
  46. greg@afs.com  (Nextmail OK)  | 
  47.