Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Radio/Checkbox highlighting

Radio/Checkbox highlighting
Thread Tools
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 14, 2001, 09:43 PM
 
Hello ...

I want to create an NSMatrix full of buttons with standard radio button/check box-like highlighting behaviour:

x Mouse-down darkens the button (but *doesn't* show the
"alternate" image);

x Dragging darkens/undarkens the button according as
the mouse is within/without the target button's frame
(but *doesn't* darken other buttons in the matrix when
the mouse drags over them);

x Mouse-up deselects the target button, showing the
alternate image if the mouse was released within the
button's frame.

I can't even find appropriate parameters to get stand-alone buttons (no NSMatrix) to exhibit this behaviour. ("Toggle" comes close, except that mouse-down shows the alternate image as well as selecting the button.) Factoring in the NSMatrix' mouse tracking options just complicates matters.

I have been able to create a custom NSMatrix sub-class that does what I want, but I can't help but think that such a common behaviour should be supported right out of the API box.

Insights?


Thanks,

Day Late Don
     
Senior User
Join Date: Feb 2001
Location: Rochester, uk
Status: Offline
Reply With Quote
May 16, 2001, 05:36 AM
 
Why?

In my experience, wanting to make a large number of buttons is usually an indication of something gone wrong.

All words are lies. Including these ones.
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 16, 2001, 11:03 AM
 
sadie> In my experience, wanting to make a large number
> of buttons is usually an indication of something
> gone wrong.

I never said I wanted to make a *large* number of buttons. My problem exists for matrices with any number --100, 10, or just 1-- of button cells. And, as I mentioned, I can't even get individual buttons to exhibit the desired highlighting behaviour.

I want to create a bank of 5 (is that a large number?) radio buttons with a custom look (each is a different colour).

I realize now I probably shouldn't expect the emulation of radio buttons to rely on the tracking and highlighting options of regular buttons. I was wrong to think of the "selected" image (with the dot) as the "alternate" image for the control; I should think of radio buttons as "multi-stage" buttons with a different image at each stage.

Unfortunately, the imaging of these buttons seems to be hard-coded to use the system bitmaps, and Apple hasn't provided automatic support for multi-stage buttons with custom images. So, sub-classing NSButton seems to be a must. And, apparently, a sub-class of NSMatrix is in fact required to provide appropriate highlighting behavior across multiple buttons of this type.

I can deal with that (as I wrote, I have an NSMatrix sub-class that does what I want), but it seems an unnecessarily complicated and inelegant solution. I'd rather just override the images for the "off" and "on" states of a radio button or check box and be done with it.

--DayLateDon

     
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
May 16, 2001, 04:46 PM
 
Dragging the radio buttons and checkboxes from InterfaceBuilder's palette should get you the "default" behavior, at least for Cocoa apps. If there are subtle differences in radio button behavior between Carbon and Cocoa apps, maybe you could submit a bug report to Apple. But generally any Cocoa app will just use the widgets directly off of Interface Builder's palette.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:34 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2