wxButton SetBitmap not for all states

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Joelito
Earned some good credits
Earned some good credits
Posts: 128
Joined: Wed Jun 18, 2008 8:35 pm
Location: Tijuana, BC, México

wxButton SetBitmap not for all states

Post by Joelito »

Hi.

Running in Win7 msys2 with msw 3.0.5 I found a strange behave:

Code: Select all

// state is a bool after testing a running process
// same bitmap for all states: works on my linux box, not on msw
m_buttonStart->SetBitmap( state ? wxBITMAP_PNG_FROM_DATA(execute_icon) : wxBITMAP_PNG_FROM_DATA(stop_icon) );
I can see execute_icon as normal state, but when I click m_buttonStart, I only see stop_icon if the m_buttonStart losses focus.. In order to see the stop_icon i had to do this:

Code: Select all

m_buttonStart->SetBitmap( state ? wxBITMAP_PNG_FROM_DATA(execute_icon) : wxBITMAP_PNG_FROM_DATA(stop_icon) );
#if defined(__WXMSW__)
// workaround for msw
m_buttonStart->SetBitmapFocus( state ? wxBITMAP_PNG_FROM_DATA(execute_icon) : wxBITMAP_PNG_FROM_DATA(stop_icon) );
m_buttonStart->SetBitmapCurrent ( state ? wxBITMAP_PNG_FROM_DATA(execute_icon) : wxBITMAP_PNG_FROM_DATA(stop_icon) );
#endif
Is this normal on Win7?
* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux x86_64 with xfce desktop & wxgtk{2,3}-3.0.5.
Post Reply