Simple ComboBox Tick Replacement

Hey jucers,


I'd like to replace the 'tick' on the ComboBox class with a custom image.

I have attempted to add a StringArray list to a Popup menu, and ->addItems to that popupmenu including the image I wanted to use, and then passed that popupmenu to the comboBox using the .addItemsToMenu function. However considering this is a virtual function, it doesn't seem to be the right approach.

Thoughts on the most straightforward way of doing this?


Thanks so much,

Have a look at the "Look and Feel" classes:

You inherit this, override the methods you want to change (i.e. ). Then you set an instance of your look and feel class either to that component or to the parent component as defaultLookAndFeel.

You can use the original drawing code as a starting point:

HTH, daniel

Thanks for the response Daniel,


The tick is part of the popup menu class, which is inherited by the comboBox class. Would I set a popup menu lookAndFeel and set that to the ComboBox as well? I spent a bit of time on it yesterday and it seems to go beyond a typical LookAndFeel use case.


If anyone else reading this has replaced the 'tick' graphic in the ComboBox class, please let me know your method of doing so.



Ok, I see. The Combobox doensn't inherit the popup menu, but it is created in the showPopup method:

This is virtual so that you can override it with your own custom popup mechanism if you need some really unusual behaviour.

But the popup menu takes the default look and feel, so either alter that one, or override this:

void ComboBox::showPopup() 
    PopupMenu menu; 
    menu.setLookAndFeel (&getLookAndFeel()); 
    addItemsToMenu (menu); 
    menu.showMenuAsync (PopupMenu::Options().withTargetComponent (this) 
                                            .withItemThatMustBeVisible (getSelectedId()) 
                                            .withMinimumWidth (getWidth()) 
                                            .withMaximumNumColumns (1) 
                                            .withStandardItemHeight (label->getHeight()), 
                        ModalCallbackFunction::forComponent (comboBoxPopupMenuFinishedCallback, this)); 

I just followed getLookAndFeel(), I think you can simply alter the void LookAndFeel_V2::drawPopupMenuItem as well, the drawing is done here:

So it's the same look and feel you set for the ComboBox...

Good Luck,



Thanks for taking the time to look into this Daniel. I will let you know my results. :)

I'm looking forward to it. I'm just starting to style my plugin, so reading how the details of look and feel work was not that altruistic at all ;-)