
Hello all, This should be simple, and I thought it had it working, but I've broken it and can't figure out why. What I want is to invoke the callback whenever the user activates and entry in a dialogbox, so I did both this : Gtk.on entry Gtk.entryActivate (boxHandler entry) (I believe this supercedes the previous method which was onEntryActivate) and this Gtk.on entry Gtk.entryPreeditChanged (boxHandler entry) however neither method will invoke the callback. The program compiles and works just fine, it's just that the callback never runs. Thank you, Brian

Hi Brian, On 25/07/13 04:14, briand@aracnet.com wrote:
This should be simple, and I thought it had it working, but I've broken it and can't figure out why.
What I want is to invoke the callback whenever the user activates and entry in a dialogbox, so I did both this :
Not sure what you mean by dialogbox here. A complete (but small) example would help.
Gtk.on entry Gtk.entryActivate (boxHandler entry)
Perhaps it's a terminology confusion: in GTK, "activate" for an entry means "pressing return key". This program works fine for me, pressing return prints the text I entered in the box: ----8<---- import Graphics.UI.Gtk main :: IO () main = do initGUI window <- windowNew entry <- entryNew set window [ containerBorderWidth := 10, containerChild := entry ] entry `on` entryActivate $ putStrLn =<< entryGetText entry onDestroy window mainQuit widgetShowAll window mainGUI ----8<----
(I believe this supercedes the previous method which was onEntryActivate)
and this
Gtk.on entry Gtk.entryPreeditChanged (boxHandler entry)
however neither method will invoke the callback. The program compiles and works just fine, it's just that the callback never runs.
Maybe you instead mean to do something when the widget is focussed for input? ----8<---- import Control.Monad.Trans (liftIO) ... entry `on` focusInEvent $ tryEvent $ liftIO $ putStrLn "focusInEvent" ----8<---- Claude -- http://mathr.co.uk

On Sat, 27 Jul 2013 15:44:44 +0100
Claude Heiland-Allen
Perhaps it's a terminology confusion: in GTK, "activate" for an entry means "pressing return key". This program works fine for me, pressing return prints the text I entered in the box:
----8<---- import Graphics.UI.Gtk
main :: IO () main = do initGUI window <- windowNew entry <- entryNew set window [ containerBorderWidth := 10, containerChild := entry ] entry `on` entryActivate $ putStrLn =<< entryGetText entry onDestroy window mainQuit widgetShowAll window mainGUI ----8<----
yes that's part of the problem - I thought that tabbing through the fields should be an "activate" event. still I had some other problem, and I'm not sure what it was. however thanks to your example I now have the dialog working as it should. thanks very much ! Brian
participants (2)
-
briand@aracnet.com
-
Claude Heiland-Allen