Is there a way to uniquely style items in the wxChoice widget in wxPerl (WxWidgets)?

317 views Asked by At

I'm trying to figure out if it's possible to style the items in a drop-down menu when I use the wxChoice widget. Best I can tell, it's not possible but I just wanted to ask the greater Perl community to make 100% sure that I was correct in my thinking.

My goal would be to color some of the items in the pull-down red, while others were black. I noticed that the wxChoice widget has the method SetForegroundColour, but this colors all the text in the wxChoice widget.

$driveCB->SetForegroundColour(wxRED);

Results in a pull-down looking like this:

wxChoice example using SetForegroundColour

Is it possible to individually style wxChoice items?

2

There are 2 answers

1
SteveL On BEST ANSWER

You can't do it with a wxChoice, but you could use a wxOwnerDrawnComboBox, there is an example of it in the wxWidgets samples, in the folder called combo.

1
asdf000 On