[wxStaticBitmap] SetBitmap problem

Cyril cyril.delmas at cgin.fr
Thu Dec 20 10:13:01 PST 2007


Hello all,
I have a problem using wxStaticBitmap::SetBitmap, with C++, under Win XP 
and WxWidgets 2.8.
These are samples of the code :

in the dialog constructor :
serviceStatusBitmap = new wxStaticBitmap(this, SERVICE_STATUS_BITMAP_ID, 
wxNullBitmap);

in the do_layout() function (called from the constructor) :

wxBoxSizer* controlSizer = new wxBoxSizer(wxHORIZONTAL);
wxStaticBoxSizer* serviceControlSizer = new 
wxStaticBoxSizer(serviceControlSizer_staticbox, wxHORIZONTAL);
serviceControlSizer->Add(serviceStatusBitmap, 1, 
wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
controlSizer->Add(serviceControlSizer, 1, wxEXPAND, 0);

regularly, I check the state of a Windows Service, so I do that :
serviceStatusBitmap->SetBitmap(*which); // which is a preloaded bitmap 
selected according to the service status
serviceStatusBitmap->Update();

This code make a strange display : the old bitmap is displayed at the 
right place (that is : centered), but the new one is displayed at 0,0.
I can make the old bitmap disappear adding this line :
serviceStatusBitmap->SetBitmap(wxNullBitmap);
before the last code snippet.

What's the matter ?

ps : I have a similar problem with a wxAnimateCtrl which is displayed 
against the left side instead of being centered.

Thanks.

-- 
Cyril Delmas - Développeur d'applications

Compagnie Générale d'Imagerie Numérique
55, route Jean Briaud
33693 Mérignac Cedex
France

Tél : +33 5 57 89 03 00 (standard)
Tél : +33 5 57 89 03 05 (direct)




More information about the wx-users mailing list