resizing custom wxBitmapButtons

Hi list,

I have a problem regarding resized wxBitmapButtons. Briefly, I have a "matrix" of wxBitmapButtons like this:

frame
   +--- main sizer
           +--- main panel
                 +--- sizer 0
                         +--- custom wxBitmapButton
                 ...........
                 +--- sizer n
                         +--- custom wxBitmapButton

When the frame is resized, if the number of rows/columns of custom wxBitmapButtons changes, I recalculate the layout, this meaning that all the custom wxBitmapButtons and their sizers are destroyed/removed and recreated (including the bitmaps for the buttons), then I do a GetSizer()->Layout() and draw all the custom wxBitmapButtons. When drawing the custom wxBitmapButtons I use GetClientSize().

The problem is that when the users resizes the frame too fast, the bitmaps of the custom wxBitmapButtons are either too large or too short. I.e. seems that GetClientSize() does not return the last size. A Refresh() for the custom wxBitmapButtons within onSize() does not help either.

I've tried the same thing with custom wxPanels instead of custom wxBitmapButtons and it worked just fine. What is wrong here, does anyone have any idea?

Thank you,

Cristina.

C. Iacob wrote:

When the frame is resized, if the number of rows/columns of custom wxBitmapButtons changes, I recalculate the layout, this meaning that all the custom wxBitmapButtons and their sizers are destroyed/removed and recreated

This is unrelated to your question, but related to a recent question posted on this list: when you destroy and re-create your buttons, do you re-bind the new events? If so, all the old event bindings stick around. This might get to be an issue after a lot of resizing. Perhaps you could change the properties of the buttons, rather than destroying them and re-creating them?

wx.BitmapButton.SetBitmapLabel()
wx.BitmapButton.SetClientSize()
wx.BitmapButton.Move()

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov