🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #1223

Re: TextField: can't change textGray and seemingly weird side effects

#1223
From: Gregory H. Anderson
Date: Wed, 19 Aug 1992 01:00
39 lines
2059 bytes
Reply-To: greg@afs.com

In article <1992Aug15.205626.2573@pkyn.questor.wimsey.bc.ca>  
ldp@pkyn.questor.wimsey.bc.ca (Lyle Parkyn) writes:
> 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.
> 
> [stuff deleted]
> 
> I am left with the conclusion that TextField has some methods with 
> undocumented and undesirable side effects. Did anyone else have similar 
> experiences? 
> 

The only thing that tripped you up was the setEnabled: messge. All NeXT  
controls respond to this method by graying themselves down in some way, to  
indicate their disabled state. This is a desirable user interface clue  
which would be defeated if you could subsequently change the color back  
under program control. For the record, here is the hierarchy:

  setEditable: - can the text be changed?

  setSelectable: - regardless of editable state, can the text be selected  
and copied with the selectText: and copy: methods?

  setEnabled: - will the control react to or send any actions? (NO always  
implies setEditable:NO and setSelectable:NO)

There is a "gotcha" in the interactions of the first two methods. Sending  
setEditable:NO automatically performs setSelectable:NO, which I consider a  
mistake. So if you want the text to stay selectable, you must follow any  
setEditable:NO with a setSelectable:YES.

--
Gregory H. Anderson          | "We're very tolerant around here,
Benevolent Dictator-for-Life |  being only amateurs ourselves."
Anderson Financial Systems   | - Tortoise (Godel, Escher, Bach)
greg@afs.com  (Nextmail OK)  | 
Technical Details
Message-ID: <1992Aug19.010043.820@afs.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!rpi!psinntp!psinntp!afs!greg

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!rpi!psinntp!psinntp!afs!greg
From: greg@afs.com (Gregory H. Anderson)
Newsgroups: comp.sys.next.programmer
Subject: Re: TextField: can't change textGray and seemingly weird side effects
Message-ID: <1992Aug19.010043.820@afs.com>
Date: 19 Aug 92 01:00:43 GMT
Article-I.D.: afs.1992Aug19.010043.820
Sender: greg@afs.com
Lines: 39