Clicked() with modifiers


#1

So I’ve subclassed ImageButton and have a method clicked (const ModifierKeys& modifiers) which gets called and I check for the modifier key… all that works fine… but the problem is that the button changes state visually before it reaches clicked (const ModifierKeys& modifiers)

I want to change the ImageButton image to disabled if the Alt modifier is down when the button is clicked… which all works fine but the button is being repainted ‘down’ & ‘up’ before I get the clicked() call from Button::sendClickMessage… so the button flashes the normal ‘down’ image before I get the chance to change the image.

Is there any way to get the modifier before the button is repainted?

Thanks,

Rail


#2

Trying to make ImageButton do even more things that it wasn’t designed for? Seriously, if the task you’re doing is so different from the functionality of a basic ImageButton, why don’t you just write your own custom class for it?


#3

'Cause ImageButton does 99.9999% of what I need… I have all the other functionality working for the mute and solo buttons… just trying to add the last step of “solo isolate” when the user Alt clicks on a solo button.

I take it from your response that this won’t be possible…

Cheers,

Rail


#4

Anything is possible if you override enough methods, but it sounds to me like the kind of thing where you’d get a cleaner result by just writing a custom control that does what you need.


#5

Cool.

Thanks!

Rail


#6

Did you get anywhere with this Rail?, I'm looking to do a similar thing.

Thanks,
Alan


#7

I wrote my own ImageButton class derived from Component, ChangeBroadcaster and SettableTooltipClient.

Rail