wxWindow styles -- no border or background

This is one of those where I feel certain I'm overlooking something, but I can't figure out what:

I want a listbox to have no border (and hence no 3D effects) and a transparent background -- in other words, the control won't show up at all, only the items in it.

I've tried to do this with what seemed like the obvious options, wxNO_3D and wxTRANSPARENT_WINDOW, but they didn't seem to do anything. Actually, reading the descriptions, I'm not sure they're supposed to do what I want.

So the question is, is there a way to do what I want at all? Do I need to make the window background the same as the frame background? Is there any way I can get rid of the border altogether?

Sincerely,
Derek

Derek Croxton wrote:

This is one of those where I feel certain I'm overlooking something, but I can't figure out what:

I want a listbox to have no border (and hence no 3D effects) and a transparent background -- in other words, the control won't show up at all, only the items in it.

On Windows you can get something like a transparent window by catching the EVT_ERASE_BACKGROUND event and then doing nothing in the handler, but if the control draws the background itself in its EVT_PAINT then the background will still be there. The best way to make a control appear transparent is to make its background be the same as its parent. You can usually[*] remove the border by using the wxNO_BORDER style.

[*] Not all platforms and/or themes will allow the background colour and/or border styles to be changed for all controls.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Derek Croxton wrote:

This is one of those where I feel certain I'm overlooking something, but I can't figure out what:

I want a listbox to have no border (and hence no 3D effects) and a transparent background -- in other words, the control won't show up at all, only the items in it.

On Windows you can get something like a transparent window by catching the EVT_ERASE_BACKGROUND event and then doing nothing in the handler, but if the control draws the background itself in its EVT_PAINT then the background will still be there. The best way to make a control appear transparent is to make its background be the same as its parent. You can usually[*] remove the border by using the wxNO_BORDER style.

[*] Not all platforms and/or themes will allow the background colour and/or border styles to be changed for all controls.

Thanks as usual, Robin. I don't see wxNO_BORDER as one of the styles for the wxWindow class. Is there some other place I can find information on "secret" features like this one? Or am I just overlooking something?

Sincerely,
Derek

Derek Croxton wrote:

Thanks as usual, Robin. I don't see wxNO_BORDER as one of the styles for the wxWindow class. Is there some other place I can find information on "secret" features like this one? Or am I just overlooking something?

It was in the docs a long time ago but was removed for some reason that I never understood (and don't remember now.) However nothing is secret as everything is in the source and usually the samples too. :wink:

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!