How to dynamically change style (Button)

Hello, world!

How does one go about changing the style of a button after it has
already been made? Or if there is none, is there some way to highlight
a button? The button can’t be a ToggleButton, it must be a
BitmapButton.

Thanks!

Hi Jonah

Jonah D. wrote:

How does one go about changing the style of a button after it has
already been made? Or if there is none, is there some way to highlight
a button? The button can’t be a ToggleButton, it must be a
BitmapButton.

I’m not sure exactly what you mean by style - if you just mean the
bitmap that is shown, you can use set_bitmap_label (and also other
set_bitmap_xxx methods for other states like hover, focus) to change the
image that’s displayed. Using set_bitmap_focus and set_bitmap_selected
will automatically deal with highlighted images for those states - you
don’t need to managed this yourself.

If you need to change the formal “style” argument (eg Wx::BU_AUTODRAW)
then you have to swap two different widgets in and out, and show and
hide them.

alex