[Haskell-cafe] Gtk2Hs, Glade, Multiple windows/dialog in one interface file.

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun Jul 8 15:46:17 EDT 2007

On Jul 8, 2007, at 15:37 , D.V. wrote:

> Is it possible to have multiple windows in a glade file, and display
> only one when the program starts, then show/hide the others as the
> need arises ?

You can but it's not well documented.

I found that it was necessary to load the window each time you need  
it.  (you must re-load the XML each time)

>   (Just g) <- xmlNewWithRootAndDomain (pathLoad ++ "hwatchmwp.glade")
>                                       (Just "vwin")
>                                       Nothing
>   w <- xmlGetWidget g castToDialog "vwin"

(I assume it'll work because it did at program startup.  Arguably I  
should actually do error checking instead...)

I *think* the right way to handle the close button is the onDelete  
(not onDestroy which happens far too late to back out) handler.  (I  
just noticed that I'm not actually handling it, where I'd thought I  
was.  Oops.)

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list