Custom radio button failure with bindings
Custom radio button failure with bindings
- Subject: Custom radio button failure with bindings
- From: Ricky Sharp <email@hidden>
- Date: Tue, 22 Feb 2005 12:47:58 -0600
I have a pretty rich collection of custom cells and controls that I'm now ensuring work well with bindings.
I started out with a sample project containing standard controls and cell to ensure I got everything right. This worked out a-ok.
I'm now replacing one standard item at a time with my custom item to ensure that bindings behave as expected. I'm running into a problem with a custom NSMatrix (IIRadioGroup) containing my own radio buttons (instances of IIButtonCell).
I've bound selectedIndex of the matrix to my model. When full keyboard access is used to move the amongst the radio buttons, the value in my model changes as expected. If I click on the radio button, it does become the new selected cell (previous one is deselected as expected), but my model isn't updated.
In IIRadioGroup, I do provide an override to mouseDown. I needed to do this in order to provide the same user experience with my custom radio buttons as they'd get with the standard buttons.
In my mouseDown, when a cell ultimately needs to be selected, I use selectCell. I also tried using selectCellWithTag. Both do select the appropriate cell, but my model isn't updated. This leads me to believe that such a change isn't being observed. But why? Is interacting with the keyboard ultimately calling some internal private method of NSMatrix to change the selection which is in turn observed by the bindings system? Shouldn't selectCell, selectCellWithTag, etc. all bottleneck through a common routine which will change a value that is observed?
FWIW, I replaced using my custom NSMatrix with the standard NSMatrix. No difference; keyboard interaction works, but clicking doesn't.
Is the solution to manually do things? For example, wrapping selectCell like this:
[self willChangeValueForKey:@"selectedIndex"];
[self selectCell:theCell];
[self didChangeValueForKey:@"selectedIndex"];
This seems wrong to me though.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden