[wxGridBagSize] use internal min-size?

Christian Buhtz exsudat at gmx.de
Wed Feb 13 02:32:04 PST 2008


If I use a wxGridBagSizer() without any gaps it is not possible to 
arrange very little wxWindows side by side.

Please look here for an example:
<http://miktion.rahner-edv.de/bus/wxgb.png>

It is a wxGridBagSizer with 7x7 cells.
The cells are use by wxStaticText like this

     // layout them on sizer
     wxStaticText* pST = new wxStaticText(pParent_, wxID_ANY, "W");
     wxFont font = pST->GetFont();
     font.SetPointSize(font.GetPointSize()-3);
     font.SetFamily(wxFONTFAMILY_MODERN);
     pST->SetFont(font);
     wxSize sizeMin = pST->GetSize();
     sizeMin.SetWidth(wxMax(sizeMin.GetWidth(), sizeMin.GetHeight()));
     sizeMin.SetHeight(sizeMin.GetWidth());
     pST->Destroy();

     for (iterate througth the cells)
     {
         pST = new wxStaticText(pParent_,
                                wxID_ANY,
                                "*",
                                wxDefaultPosition,
                                sizeMin,
                                wxALIGN_CENTRE | wxST_NO_AUTORESIZE);
         pST->SetMinSize(sizeMin);
         pST->SetFont(font);
         pST->SetBackgroundColour(*wxRED);
         pGBSizer_->Add(pST, (*it), wxGBSpan(), wxALIGN_CENTER);
     }

There should be no space between the cells but there is one. Why?





More information about the wx-dev mailing list