From: <jan...@t-...> - 2004-12-02 11:45:43
|
Hello. (This is my first contribution to this mailing list.) Currently I have the following code for calling a function "owned" by a MDIChildFrame from a menu item of the MDIParentFrame: (The code is not complete! No MDIChildFrames are added, etc.) ('_' denotes something irrelevant.) gui = do f <- mdiParentFrame [] m <- menuPane [text := _] i <- menuItem m [text := _, on command := foo f] where foo = keyEvent 'f' keyEvent :: Char -> MDIParentFrame a -> IO () keyEvent char frame = do child <- get f activeChild if objectIsNull child then return () else do handler <- windowGetOnKeyChar child handler (EventKey (KeyChar c) noneDown (point 0 0)) openChild :: MDIParentFrame a -> IO () openChild parent = do f <- mdiChildFrame parent [] -- Features "owned" by the MDIChildframe f. var1 <- newIORef _ var2 <- newIORef _ var3 <- newIORef _ set f [on (charKey 'f') := foo var1 var2 var3] where foo var1 var2 var3 = do modifyIORef var1 _ modifyIORef var2 _ modifyIORef var3 _ So I'm abusing a key event handler, but this isn't nice, since abusing is BAD. What I miss, is some kind of "user event handler". There is no such thing, or did I miss something? BTW: wxHaskell is great, I enjoy very much using it. At the moment I'm programming a 3D CAD application using OpenGL. It works fine. Thanks! Oh, and there was another thing. Loading the CAD-files takes very long (about 10 seconds on my machine). It isn't possible to implement s.th. like a loading-dialog at the moment, because threading is not supported, right? (Using "on idle" doesn't work for me, because it is very hard to separate the loading function into smaller steps.) Regards, Jan |