Re: two tables, one button
Re: two tables, one button
- Subject: Re: two tables, one button
- From: Brent Gulanowski <email@hidden>
- Date: Wed, 11 Jun 2003 13:30:19 -0400
On Wednesday, June 11, 2003, at 12:34 PM, Chris Silverberg wrote:
Hi folks,
Imagine a window with two NSTableViews and an NSButton. The button is
intended to perform an action on the selected item of either table
that is
firstResponder. If there is no selection in the table that is
firstResponder, the button should be disabled.
I am concerned that you are using an implementation concept
(responders) when discussion user interface behaviour. What is the
user's impression? What distinguishes the possible selected items in
the table views?
I'm not clear on how to keep the button in sync with the two tables.
Watching for NSTableViewSelectionDidChangeNotification is a partial
solution... but if the user switches between the tables the selection
may
not change, but the one table may not have a selection which requires
the
button to enable or disable.
Every time you select an item in a table, it will send an action
message to its target. If the target is not the window controller, the
target should know about the window controller and be able to retrieve
its id. Then it can ask the window controller for the button's id, and
tell the button whether to be enabled or not. Further, if the button is
enabled, the id of the selected item would be stored as the affected
object for whatever process the button's action is meant to initiate.
How does the user select a table without selecting an item in the
table? Not really important, just curious. Changing the table will
necessarily involve an event, which will cause an action, which will be
received by a target which should be able to tell the button to enable
or disable itself, based on the combined state of selected item in
table and currently "active" table, if it is different than the one
which contained the most recently selected table item.
So, I guess my question is... is there a way to be notified if the
firstResponder changes for a window or a particular object? Or is
there a
better way of maintaining the enable/disable state of a button that
works on
multiple tables?
I'm not sure; I suspect it is more trouble than required to solve your
problem.
--
Brent Gulanowski email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.