From: David R. <dr...@jd...> - 2003-12-01 15:22:01
|
On Mon, Dec 01, 2003 at 03:28:44PM +0100, Daan Leijen wrote: > >>Use "virtualSize" to set the scrolling area. Use "scrollRate" to set the > >>speed of the scrollbars. > > > >In the example program below, I can't resize the window smaller than the > >size required to fit all the labels, and thus no scrollbars show up. Is > >there any way to use layout to arrange widgets in a scrolled window and > >still get scrollbars? Or is there some other method that I should be using > >to arrange the widgets in a scrolled window? > > Honestly, I have no idea :-) Maybe you can find some info in the > wxWindows documentation? Furthermore, it is rather strange for a UI > to put widgets inside a scrollable window -- normally all widgets > are either visible, or in a notebook or something, but not dynamically > placed. I don't think putting widgets in scrolled windows is that uncommon. The only reason I can see to avoid it would be if you were afraid the memory overhead of using a large number of widgets would be prohibitive. It is pretty standard that tree widgets exist inside scrollable windows--otherwise they won't typically fit on your screen. In fact, any time you have a non-fixed number of widgets they should be in a scrollable window--e.g. an image browser that displays thumbnails might want to have each thumbnail be a widget, and they'd obviously need to be in a scrolled window. > So, 1) it might be that this is just not something that is properly > supported on wxWindows, or 2) you need to call specific wxWindows > functions to get the sizers running correctly within scrollable windows, > or 3) you shouldn't use sizers here but place all widgets yourself at > specific spots (and install a repaint handler). The impression I get from the wxwin docs is that 4) it should work automatically. Quoting the section on wxScrolledWindow: "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. The scrolling area will be set to the size requested by the sizer and the scrollbars will be assigned for each orientation according to the need for them and the scrolling increment set by wxScrolledWindow::SetScrollRate." My only guess is that someone is calling wxWindow::SetSizeHints and setting the minimum size to be equal to the size of the scrolledWindow's contents. At least with wxHaskell 0.3 I used to be able to make the scrolledWindow work right by calling SetSizeHints to reset the size hints to their default values (all arguments being -1). -- David Roundy http://civet.berkeley.edu/droundy/ |