From: Daan L. <daa...@xs...> - 2003-12-01 14:28:48
|
Hi David, >> 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. 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). If the case is 1) or 2), we/I might be able to solve it using some abstractions in Haskell. If it is 1) or 3), we should probably report it as a bug to the wxWindows dev's. Thanks for the example program though, it makes a good test case. > I've basically just been trying random permutations, Good luck ;-) Daan > but haven't been able to guess how to get > scrollbars. > > import Graphics.UI.WX > > main = start test > > test = do > f <- frame [text := "Testing wxHaskell"] > quit <- button f [text := "Cancel", on command := close f] > scrolled <- scrolledWindow f [virtualSize := size 500 500, > scrollRate := size 20 20] > set scrolled [layout := margin 5 $ column 5 labels] > set f [layout := column 0 [fill $ widget scrolled, > margin 5 $ row 5 [hglue, widget quit, hspace 20]], > clientSize := size 100 100 -- this doesn't seem to have any effect at all. > ] > return () > > labels = l 30 where l 0 = [] > l n = label ("Label "++show n) : l (n-1) |