0

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?

Community
  • 1
  • 1
slm
  • 15,396
  • 12
  • 109
  • 124

2 Answers2

1

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.

SteveL
  • 1,811
  • 1
  • 13
  • 23
  • Thanks that's what I was looking for. The link to the wxWidget samples is here: http://docs.wxwidgets.org/trunk/page_samples.html. Specifically here's the link to the wxOwnerDrawnComboBox: http://svn.wxwidgets.org/viewvc/wx/wxWidgets/trunk/samples/combo/. The markup for the ComboBox is here: http://svn.wxwidgets.org/viewvc/wx/wxWidgets/trunk/samples/combo/combo.cpp?view=markup – slm Oct 20 '11 at 14:06
-1

The documentation says NO

asdf000
  • 79
  • 2
  • Would be helpful if you included more constructive comments around why this isn't possible for other people that may stumble into this question in the future. I did read the documentation but it's a C/C++ library being used by Perl programmers so they may not be able to understand it. – slm Oct 20 '11 at 13:53