[gdal-dev] Problem when resizing main frame in Windows 7.

Ramiro Gonzalez ramirogonzalez at suremptec.com.ar
Tue Aug 28 10:42:20 PDT 2012


Hi,

I use wx 2.8.12 in a multiplatform application, I have been having a
problem with the layout when I resize the main Frame, but '''only happens
in Windows 7'''.

I couldn't find the source of the problem, so I was hoping someone could
help me with it.

My application have several wxPanels composed in a tree structure with
sizers, after resizing the top level window, the layout algorithm executes,
but stops before reaching the last few panels(near leafs, and only in one
branch of the tree). This branch of the tree is 8/9 panels in lenght.

I looked closely to the state of the sizers in that branch, and find out
that one of the sizer's dimension was not being updated, so its dimension
was different to the size of the containing window.
{{{
Window size: h 891 s 1076
Sizer size: h 389 s 656
}}}

While debugging, I added a panel several levels up in the tree(containing
the inconsistent panel). After this, the bug moved one level up, that is,
the inconsistency between the windows an the sizer now happened in the
parent of the previously broken window.

As a temporal fix, I am listening for wxEVT_SIZE in one of the
parents(before broken sizer) and manually fixing the Size mismatch:
{{{
void FixSizers(wxWindow* pWindow) {
   if(!pWindow->IsShown())
      return;

   wxSize windowsize =  pWindow->GetSize();
   if (pWindow->GetSizer())
      pWindow->GetSizer()->SetDimension(0, 0, windowsize.GetWidth(),
windowsize.GetHeight());

   wxWindowList& children = pWindow->GetChildren();
   for (size_t i = 0; i < children.size(); i++)
      FixSizers(children[i]);
}
}}}

This solved the problem, but I would like to know if this has happened to
someone else, and what could be a probable cause of this behaviour?

Thanks
Ramiro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120828/2a7a9618/attachment.html>


More information about the gdal-dev mailing list