Re: NSMatrix problem
Re: NSMatrix problem
- Subject: Re: NSMatrix problem
- From: Bill Bumgarner <email@hidden>
- Date: Tue, 3 Jul 2001 15:42:50 -0400
Ahhh... OK; I ASSumed that you were doing this programmatically because
I thought it "just worked". Sorry about that.
Checking with IB, it works fine with a matrix of checkboxes; they can
be in any state [00, 01, 10, 11] and it sticks.
With a Radio button, the buttons can start out both turned off, but as
soon as one is turned on, it can't be toggled off and, subsequently,
there must always be at least one radio button selected.
One could argue that this is a feature, not a bug-- i.e. a set of radio
buttons are always expected to have one button selected and the fact
that you can start with nothing selected is likely a bug in and of
itself.
If you need a UI that enforces a single selection, then throwing the
matrix into Radio mode is likely the right way to go. You can support
"no selection" by adding an extra button labeled "- none -" or some
such. In this case, you would want to use Radio buttons because the UI
is behaving in a radio button fashion.
If you need a UI that allows multiple selection (or none), then throwing
the matrix into Highlight mode and using checkboxes is the way to go.
In particular, this will allow anything from multiple to, optionally, no
selection at all.
If you really want a set of checkboxes that act like a radio button, but
also allow no selection at all (violating HI guidelines), it could be
done by implementing an action method that deselects any previously
checked checkbox (or sets the checked/unchecked state to whatever you
want). However, in this case, you do not want to use Radio or, even,
Highlight mode because you are effectively going to be tracking the
state yourself.
It is likely that the deselectAllCells, etc, stuff didn't work because
the Matrix is explicitly in Radio mode....? I would need to see the
context of the code to conjecture more intelligently than that...
b.bum
On Tuesday, July 3, 2001, at 12:30 PM, Mark T wrote:
Is there a reason why you need to create the matrix of checkboxes
programmatically? It can be done in IB-- simply drag out a checkbox,
hold down the option(alt) key, and drag out as many checkboxes you
need. The end result is are buttoncells configured as a checkboxes
that live within an NSMatrix.
At the very least, you could do the above and figure out how they are
configured to figure out what is wrong with your code. I suspect it
is a configuration problem on the NSMatrix; in particular, when you
click on the checkbox, it unchecks itself but the matrix promptly
rechecks it as it "selects" the cell containing the checkbox.
I did create the NSMatrix in IB, that's what I've been doing all along.
The creation of the matrix is fine and the configuration appears to be
as well(radio mode, allows empty selection). But the matrix refuses to
allow both checkboxes to be unchecked after either has been clicked on.
I've tried [theMatrix deselectAllCells] with no effect. I've also tried
[[theMatrix cellAtRow:0 column:0] setState:NSOffState] and [[theMatrix
cellAtRow:0 column:0] setIntValue:0] for each cell of the matrix. Same
lack of result. Any ideas?
Mark T.