From: Daan L. <daa...@xs...> - 2003-12-01 12:49:22
|
Hi David, > The refit function is definitely a nice addition, but I've run into > difficulties again in not been able to figure out how to get my scrolled > window working when it contains widgets (in a layout) that resize > themselves and then call refit. When they do this, the scrolled window > gets resized to be big enough to contain the widgets, and won't let the > user make it any smaller. I'm not sure what the problem here is. The > layout should be determining the virtualSize of the scrolled window, not > its actual size as it seems to be doing. It is the correct behaviour for "refit" -- just not the behaviour that you want :-) I think we need a special refit operation that does re-layout the child widgets, but increases/decreases the "virtualSize" of a scrolled window instead of its clientSize. I am kind of busy with other things but I hope to look into it somewhere this week, but if you feel like hacking, I have added some implementation hints to the end of this mail. > Is there some trick I need to know in order to get a scrolledWindow with > scrollbars? Use "virtualSize" to set the scrolling area. Use "scrollRate" to set the speed of the scrollbars. > Totally unrelated: > > It seems that wxhaskell doesn't compile with ghc 6.2 because parsec has > moved into its own package. I heard about that, however, I have decided not to support 'unreleased' ghc versions actively. For now, you can probably just add > HCFLAGS += -package parsec to the makefile to get things working. All the best, Daan. --------------------------------- hints for implementing refitVirtual --------------------------------- In WXCore/Layout.hs are the following functions: windowRefitMinimal and windowReLayoutMinimal: windowRefitMinimal just gets the parent window and calls relayout: windowReFitMinimal :: Window a -> IO () windowReFitMinimal w = do p <- windowGetFrameParent w windowReLayout p windowRelayout gets the sizer of a window and calls "windowFit" to re-layout the child widgets. windowReLayoutMinimal w = do windowLayout w szr <- windowGetSizer w when (not (objectIsNull szr)) (sizerSetSizeHints szr w) windowFit w At the end, the new clientSize of a window is set. For a "windowReLayoutVirtual", one probably doesn't want to call "windowFit" but set the virtual size of a window instead?? |