Best way to enable/disable a control based on another control?
Best way to enable/disable a control based on another control?
- Subject: Best way to enable/disable a control based on another control?
- From: Evan Gross <email@hidden>
- Date: Thu, 28 Jun 2001 20:32:35 -0400
Hi list,
I've been playing with Cocoa for a couple of weeks now, and have a question
that doesn't seem to be addressed in any of the sample code I've seen...
What's the generally accepted technique to enable/disable a control in a
window (NSButton in my case) based on the setting of other controls in that
window (in my case an NSTextField - contents empty or not - and an
NSOutlineView, whether something is selected or not)?
I have read the NSUserInterfaceValidation stuff, and it would appear to
exist for purposes such as this, but I'm not quite sure whether a) it's what
I should be using and b) just how it's supposed to be used.
I could certainly use notifications to do this (NSTextDidChangeNotification
and NSOutlineViewSelectionDidChangeNotification), but this doesn't seem all
that elegant an approach somehow.
And I'm also quite surprised that the Find panel in most Cocoa apps doesn't
bother to deal with this - all buttons are always enabled even if there
isn't any text in the Find field! I'd generally consider this a bug - none
of the Carbon apps I use behave this way.
Just wondering if there's any particular reason for this behavior, but
mostly interested in the best way to get things working the way I want...
Thanks,
Evan Gross
Rainmaker Research Inc.
--
+------------------------------------------------------------------------+
| Evan Gross, Rainmaker Research Inc. <
mailto:email@hidden> |
| - Developers of Macintosh and Windows Software - |
| Spell Catcher 8 for Mac OS and Windows from Casady & Greene, Inc. |
| Visit <
http://www.spellcatcher.com> |
| Aladdin Transporter from Aladdin Systems, Inc. |
| Visit <
http://www.aladdinsys.com> |
| The DiskTools Collection for Mac OS, shareware |
| Visit <
http://members.home.net/rainmakerinc> |