Hi Joshua,

On 15.12.2011, at 19:33, Joshua Ball wrote:

> Hi,
>
> The following program crashes with the following error:
>
> ** ERROR **: gtk2hs_value_as_haskellobj: unable to handle GValue  
> with type GParam
> please report this as a bug to gtk2hs-devel@lists.sourceforge.net
> Trace/breakpoint trap
>
>
> module Main where
>
> import Graphics.UI.Gtk
>
> main = do
>   initGUI
>   window <- windowNew
>   cb <- comboBoxNewText
>   comboBoxAppendText cb "one"
>   comboBoxAppendText cb "two"
>   on cb popupShownNotify $ putStrLn "popupShownNotify"
>   containerAdd window cb
>   widgetShow cb
>   widgetShow window
>   mainGUI
>
> I'm using GHC version 7.2.1. I filed a bug at 
> http://hackage.haskell.org/trac/gtk2hs/ticket/1243 
> , but it looks like that tracker doesn't get much love.
>

Yes, the bug tracker is not something I consult on daily basis.

I've investigated and it turned out that the signal was incorrectly  
connected, so it never worked.

In order to fix this, I've generalized the whole approach: the signal  
above was listening for a property change, it wasn't a normal signal.  
So I added a new meta-signal handler in gtk/.../Object called  
notifyProperty that you simply pass an Attribute for which you want to  
be notified when it changes. Not every Attribute is a Property, but it  
works with many common ones, for instance, with the comboBoxPopupShown  
attribute. So your example now looks like this:

module Main where

import Graphics.UI.Gtk
import Control.Monad.Trans

main = do
   initGUI
   window <- windowNew
   cb <- comboBoxNewText
   comboBoxAppendText cb "one"
   comboBoxAppendText cb "two"
   comboBoxSetActive cb 0
   on cb (notifyProperty comboBoxPopupShown) $ putStrLn  
("popupShownNotify")
   containerAdd window cb
   widgetShow cb
   widgetShow window
   on window deleteEvent $ liftIO mainQuit >> return True
   mainGUI


The fix is in darcs.

Cheers,
Axel

> Josh "Ua" Ball
>
> -- 
> Borrow my books: http://goo.gl/UBbSH
> ------------------------------------------------------------------------------
> 10 Tips for Better Server Consolidation
> Server virtualization is being driven by many needs.
> But none more important than the need to reduce IT complexity
> while improving strategic productivity.  Learn More!
> http://www.accelacomm.com/jaw/sdnl/114/51507609/_______________________________________________
> Gtk2hs-devel mailing list
> Gtk2hs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel


------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Gtk2hs-devel mailing list
Gtk2hs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

Reply via email to