ComboBox and hitTest


#1

I’d like to catch right clicks for a combo, but i can’t. If i set

combo->setInterceptsMouseClicks (false, true);

it still triggers the click.

Weird thing is if i don’t use that and just add a mouseListener to the combo, if i right click then the list rolls out, but the next left click somewhere outside the Combo causes the right click for it outside (it happens when i right click just on the up/down arrows). Weird?

i guess this is because a Combo is more then one component but it would be nice if it acted like all the other components.


#2

Yes, it uses a label inside, I think, to draw and edit the text. There’s really no practical way to make it work without child components - that’d involve re-implementing all the label’s functionality directly inside the combobox.


#3

Ok but would it be possible to catch those right click events on the current version of the Combo ? if so how, if not i’ll have to make my own version, but like i said it would be nice if all the basic UI elements acted the same way in terms of mouse and keyboard.


#4

Do you think you can change this, or should implement my own ComboBox ?


#5

I think the only way to do it would be with a custom LookAndFeel::createComboBoxTextBox, which creates an adapter class that catches the click…