Hi Carlos,

I assume from the posted code that what you really want is a
StaticText widget with a scroll bar, and that you wish to 'force'
the scroll bar to be present at all times (default behaviour of
all widgets is that scroll bars appear only when they are
needed).

The code I have just tested to do this is:

module Main where
import Data.Bits
import Graphics.UI.WXCore
import Graphics.UI.WX
main :: IO ()
main = start gui
gui :: IO ()
gui = do f   <- frame   [text := "Frame"]
         tcl <- textCtrl f [text := "This is an example of using
an scroll bar with wxhaskell, it looks like don't work, so it's
true?",
                            style := wxTE_READONLY .|. wxHSCROLL
.|. wxVSCROLL]
         set f  [layout := fill $ widget tcl, clientSize := sz
200 200]
         return ()

Compared to your code, there are a few differences:

It is sufficient, for simple cases, to simply set the wxHSCROLL
and/or wxVSCROLL style on most windows if you want them to have
permanent scroll bars. The wxTE_READONLY style replicates a
StaticText (i.e. it sets text control to be read only) but with
multiple lines. If you just want a single line, StaticText can be
used instead.

You should set a clientSize on the parent frame - if you do not,
all widgets will be fittedt to their minimum possible size. The
use of the fill combinator in the layout indicates that I want
the TextCtrl to fit the whole of the allocated space.

Hope this helps.

Best regards
Jeremy

On Tue, 22 Dec 2009 20:41 -0400, "carlos gomez"
<carliro...@gmail.com> wrote:

  Hi all



I am trying to use scrolled windows with wxhaskell, but it
doesn't work,



Am I doing rightly?



here is the code:

----------------------------------------------------

module Gui where

import Graphics.UI.WXCore
import Graphics.UI.WX

main :: IO ()
main = start gui

gui :: IO ()
gui = do f   <- frame   [text := "Frame"]
         pnl <- scrolledWindow f [scrollRate := sz 20 20]
         sal <- staticText pnl [text := "This is an example of
using an scroll bar with wxhaskell, it looks like don't work, so
it's true?"]
         set pnl [layout := widget sal]
         set f  [layout := column 5 [widget pnl]]
         return ()
----------------------------------------------------

--carlos
-- 
  Jeremy O'Donoghue
  jeremy.odonog...@gmail.com

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users

Reply via email to