From: Mads <mad...@ya...> - 2007-08-02 13:15:11
|
Hi all If I run the following program: {-# OPTIONS -fglasgow-exts #-} module Main where import Graphics.UI.WX main = start $ do w <- frame [text := "ListBox Event Handling"] p <- panel w [] listBox <- multiListBox p [ items := [ "Foobar" ] ] set listBox [ on select := do set listBox [ items := [ "foo", "Bar"] ] propagateEvent ] set w [ layout := container p $ widget listBox ] and click on the listbox item "Foobar", the program crashes with: (L:6279): Gtk-WARNING **: unable to find signal handler for object(GtkListItem:0x8425e40) with func((nil)) and data(0x845ac18) The problem is that I change the listbox items from within a listbox event handler. Do anybody know if this expected behavior or is it a bug somewhere in WxHaskell, Wxwindows, or GTK? Of cause I can use this clumsy workaround: main2 = start $ do w <- frame [text := "ListBox Event Handling"] p <- panel w [] listBox <- multiListBox p [ items := [ "Foobar" ] ] let setListBoxItems = mdo t <- timer listBox [ interval := 100 , on command := do set listBox [ items := [ "foo", "Bar"] ] objectDelete t ] return() set listBox [ on select := do setListBoxItems propagateEvent ] set w [ layout := container p $ widget listBox ] but I would rather not have to. Greetings, Mads Lindstrøm |