> On 8 Apr 2016, at 7:55 PM, Nivek Research <nivek.resea...@gmail.com> wrote:
> 
> The code Sean McBride provided shows the lengths one has to go to in order to 
> approximately replace the binds offered by NSMatrix. Again, I am not opposed 
> to the work, but it does seem like a giant leap backwards from the simplicity 
> of simply using the bindings available with NSMatrix. Secondly, while the 
> documentation does state that the new radio behavior works for apps “linked 
> on 10.8” it appears from my own experimentation that this behavior does not 
> extend backwards to older versions of AppKit just because the app was linked 
> on 10.8 and I, unfortunately, still need to support back to 10.6.


So, one way or another you’re going to have to do something, since continuing 
with NSMatrix is going to become unsupported (that said, deprecated stuff can 
last an extremely long time, so I wouldn’t think it’s urgent - I still have a 
few NSMatrix instances in my apps).

Sean’s code is a solution, but not very generic. If you created a radio group 
custom view, it could automatically scan its -subviews in -awakeFromNib and 
gather all radio buttons into an array. It would be up to you how this was 
ordered, for example by its natural position in the subviews, by tag, by 
coordinate, etc. Once done, you have a way to associate a button with an index, 
and therefore a ‘selectedIndex’ property. This view could rely on the 10.8+ 
behaviour where it exists, or implement the necessary coding itself to support 
back to 10.6 - actually just a few lines. Off the top of my head I can imagine 
how this code would look and with due respect to Sean, it would be a lot less 
complicated than RRRadioBinder. (It would also be trivial to add niceties such 
as an enable/disable state that applied to all buttons in the group - I’ve 
found that necessary a few times, NSMatrix also gives you that, so it’s 
functionality you’d need to consider replacing).

Once you’ve written it, adapting your code to use it would be a matter of 
reworking your buttons in IB only, which one way or another you’d have to do 
anyway. Sometimes the way out of these problems is to stop hunting for “easy” 
solutions and break out a (small) bit of code. It often turns out to be quicker 
and easier anyway.

—Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to