gtk2hs: adding widget during runtime

Hello Haskellers, currently I work with the gtk2hs library to create a graphical user interface. Everything works fine, but there is one problem: How can I insert widgets into boxes during runtime? I tried something like: main = do initGUI window <- windowNew box <- vBoxNew True 0 l1 <- labelNew $ Just "label eins" bc <- buttonNewWithLabel "insert!" onClicked bc $ (\b -> do lh <- labelNew $ Just "neues label!" boxPackStart b lh PackNatural 0 widgetQueueDraw lh widgetQueueDraw b ) box boxPackStart box l1 PackNatural 0 boxPackStart box bc PackNatural 0 containerAdd window box widgetShowAll window onDestroy window mainQuit mainGUI That compiles fine, but the GUI never shows a "neues label!". What I want is a widget W, which takes a list L, and produces sub widgets for each element. There are also some Entry widgets and a button B. By clicking on that button B, I want to add an element to the list L, and add a sub widget to the widget W. Thank you for reading, Gary

Hi, Am Samstag, den 17.12.2011, 20:42 +0100 schrieb Gary Klindt:
That compiles fine, but the GUI never shows a "neues label!".
blind guess: Do you need to call widgetShow on the newly created widget? Greetings, Joachim -- Joachim "nomeata" Breitner mail@joachim-breitner.de | nomeata@debian.org | GPG: 0x4743206C xmpp: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/

On 12/17/2011 09:03 PM, Joachim Breitner wrote:
Hi,
Am Samstag, den 17.12.2011, 20:42 +0100 schrieb Gary Klindt:
That compiles fine, but the GUI never shows a "neues label!". blind guess: Do you need to call widgetShow on the newly created widget? Uuh! That seem's very elemental, and it works. Thank you. Greetings, Joachim
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
Gary Klindt
-
Joachim Breitner