Problem with toolbar positioning - MSW only

Robin Dunn wrote:

Frank Millman wrote:
> Hi all
>
> I have found some odd behaviour with a toolbar in a box sizer.
> Platform is Python 2.4.1, wxPython 2.6.2.1, and MSW. The
problem does not occur on GTK2.
>
> The toolbar is created correctly, and is initially
displayed correctly.
> However, a subsequent call to tb.Realize() causes it to shift its
> position upwards so that it is obscured by the static box
surrounding it.

This has been fixed already.

Great - thanks.

>
> A secondary point, which I was not going to mention, but
the attached
> program happens to demonstrate it. I still do not have
total control
> over the appearance/disappearance of scroll bars. I can see
no reason
> for them to appear when running the program, and they do
not appear if
> I run it under GTK2, but under MSW they appear. Why?

Do you see the scrollbars at startup or only when resizing
the frame smaller? (It is the latter case for me.) I think
what you may be seeing is that the there is a difference in
minsize for one of the components (probably the toolbar)
between platforms. On Windows it can go smaller than the
startup size of the grid, and so the grid is shrunk by the
sizer too, and so the scrollbars appear. On GTK the sizer is
not making the grid smaller because of the larger minsize of
the other component, and so the frame is just truncating the
unviewable parts of the grid.

I see them at startup. I am using Windows Server 2003. In fact resizing the
frame slightly smaller makes them disappear. Of course if I continue to make
it smaller, they eventually reappear. I can make grid.SetSizeHints as big as
I like, and I end up with a small grid in a large frame, but the scrollbars
still appear.

Here is one way to make them not appear at startup. I changed
'parent.SetClientSize(self.GetSize())' to
'parent.SetClientSize((self.GetSize()[0]+10,self.GetSize()[1]+10))', where
parent is the frame, and self is the panel. I don't know what this
signifies, but maybe you can explain it.

I seem to battle with the sizing of grids (or probably any ScrolledWindow,
but Grid is the only one I use). If I leave it to size itself, it does not
allocate enough space. I therefore try to calculate the required size and
call SetSizeHints, but this leads to arbitrary statements such as 'width =
34 + (3*self.GetDefaultColSize())'.

This is a quote from the wxWidgets docs -

"The most automatic and newest way is to simply let sizers determine the
scrolling area. This is now the default when you set an interior sizer into
a wxScrolledWindow with wxWindow::SetSizer."

What does 'set an interior sizer into a wxScrolledWindow' mean? I have tried
a couple of things, but none of them work.

None of this is critical to me at present, but if there is a magic formula
which just works, that would be great.

>
> A tertiary (?) point, which also happens to be demonstrated
by this program.
> I pointed out quite a long time ago that static text in a
toolbar is
> vertically aligned to the top of the toolbar under GTK2,
which looks
> odd, particularly when next to toolbar icons. It is purely
cosmetic,
> but you can see the effect when you run the program under GTK2.

Has a bug report been created for this?

Yes - 1169026, submitted on 2005-03-23.

Thanks

Frank

Frank Millman wrote:

I seem to battle with the sizing of grids (or probably any ScrolledWindow,

Yep.

but Grid is the only one I use). If I leave it to size itself, it does not
allocate enough space. I therefore try to calculate the required size and
call SetSizeHints, but this leads to arbitrary statements such as 'width =
34 + (3*self.GetDefaultColSize())'.

This is a quote from the wxWidgets docs -

"The most automatic and newest way is to simply let sizers determine the
scrolling area. This is now the default when you set an interior sizer into
a wxScrolledWindow with wxWindow::SetSizer."

What does 'set an interior sizer into a wxScrolledWindow' mean? I have tried
a couple of things, but none of them work.

It means to give the scrolled window a sizer that manages the layout of child windows, which doesn't help Grid any because it already manages its component windows itself.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!