Sizer help (min sizes, proportionality,
and window resizing)
Luca Cappa
luca.cappa at sequoia.it
Fri May 9 06:52:09 PDT 2008
Hello,
On Wed, 07 May 2008 19:18:15 +0200, Vadim Zeitlin <vadim at wxwidgets.org> =
wrote:
> On Wed, 7 May 2008 12:31:13 -0400 Harvey Chapman =
> <hchapman-wx-users at 3gfp.com> wrote:
> HC> Thanks for the hint on setting a minimum size on the entire window. I
> HC> used the code below to do that.
> The easiest way to do this is to use a sizer for the layout of the main
> (top-level) window too and call SetSizerAndFit().
> HC> on all three labels right at startup, but after the frame had been
> HC> shown. It had not effect. I don't know how to do the same to the
> HC> spaces.
> By using wxSizer::SetItemMinSize(index-of-the-spacer).
I have the same problem of Harvey, in a similar GUI setup as the one below:
+--------------------------------------+
| wxPanel (wxBoxSizer Horizontal) |
| +--------------+---------------+ |
| |wxStaticText 1|wxTextCtrl 0| |
| +--------------+---------------+ |
+--------------------------------------+
The wxPanel's content is managed by a wxBoxSizer, and it could only grow =
horizontally but not vertically, and it is not a TLW, but it is child of =
some other panel. I would like to set the wxStaticText with a proportion =
of 1, so that it could change its size accordingly when the wxPanel is =
getting resized, and the wxTextCtrl with a proportion of 0, so that it has =
a fixed size. Basically the wxStaticText contains long text which could =
also be hidden when the wxPanel is getting a smaller horizontal width, but =
the wxTextCtrl must always be visible.
The problem is that if I add to the right others wxStaticTexts (or other =
controls) and wxTextCtrls, then when the wxPanel gets smaller, the =
wxTextCtrls will simply go over the wxStaticTexts (or said in another way, =
the controls with no proportion will go over the ones with a proportion of =
1). I tryed to set a minimal size on the panel (using =
wxPanel::SetMinSize() or wxPanel::SetSizerAndFit()) without luck. Also =
tried setting SetItemMinSize for all the controls with proportion of 1, =
but it did not removed the problem. I also tryed to add some tags to the =
XRC like setting <minsize>50,-1</minsize> on the <object =
class=3D"sizeritem"> for the objects with a 0 proportion, but still nothing=
=
to do.
Any hint?
Greetings,
Luca
p.s.
The XRC looks like:
<object class=3D"wxPanel" name=3D"ID" subclass=3D"Control">
<style>wxWANTS_CHARS|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL</sty=
le>
<object class=3D"wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class=3D"sizeritem">
<flag>wxALIGN_CENTER_VERTICAL|wxLEFT|wxFIXED_MINSIZE</flag>
<border>1</border>
<option>1</option>
<object class=3D"wxStaticText" name=3D"ID_YSCALEST">
<style>wxALIGN_RIGHT</style>
<label>Y Scale (m/s=B2/div)</label>
</object>
</object>
<object class=3D"sizeritem">
<flag>wxGROW|wxLEFT|wxTOP|wxBOTTOM|wxFIXED_MINSIZE</flag>
<border>0</border>
<object class=3D"wxTextCtrl" name=3D"ID_YSCALETC">
<size>60,-1</size>
<style>wxTE_PROCESS_ENTER|wxRAISED_BORDER|wxWANTS_CHAR=
S</style>
</object>
</object>
[...]
</>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wx_propminsize_problem.png
Type: image/png
Size: 6220 bytes
Desc: not available
Url : http://lists.wxwidgets.org/pipermail/wx-users/attachments/20080509/f3=
d6c323/wx_propminsize_problem.png
More information about the wx-users
mailing list