Overwriting wxFrame::ProcessEvent in wxHaskell

Hey, In C++ wxWidgets code, I discovered (by looking at the richtext example) that when I overwritte the ProcessEvent function of my main frame, a few wonderful effects occur: * Cut/Copy/Paste/Undo/Redo menu entries work out of the box for wxTextCtrl and other simply by creating menu items with the correct id. * The menu items are also updated to be enabled or disabled correctly. I want that in wxHaskell to! But I do not know if and how I can overwrite the ProcessEvent function of wxFrame in wxHaskell ... anyone knows if there is a way? There is windowPushEventHandler, which might be what I want. But it takes "EvtHandler a" as argument, and I do not know how to write an EvtHandler with my own event handling function ... Regards, Nathan For completeness, the C++ version of what I want (taken from richedit.cpp): bool MainFrame::ProcessEvent(wxEvent& event) { if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxChildFocusEvent))) { // Problem: we can get infinite recursion because the events // climb back up to this frame, and repeat. // Assume that command events don't cause another command event // to be called, so we can rely on inCommand not being overwritten static int s_eventType = 0; static wxWindowID s_id = 0; if (s_id != event.GetId() && s_eventType != event.GetEventType()) { s_eventType = event.GetEventType(); s_id = event.GetId(); wxWindow* focusWin = wxFindFocusDescendant(this); if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event)) { //s_command = NULL; s_eventType = 0; s_id = 0; return true; } s_eventType = 0; s_id = 0; } else { return false; } } return wxFrame::ProcessEvent(event); }

On Wed, 04 Sep 2013 10:48:10 +0200, Nathan Hüsken
I want that in wxHaskell to! But I do not know if and how I can overwrite the ProcessEvent function of wxFrame in wxHaskell ... anyone knows if there is a way?
Maybe you can use the blog article "How does wxHaskell event handling work – part 1" http://wewantarock.wordpress.com/2011/06/17/how-does-wxhaskell-event-handlin... It seems that there is no part 2 of this story. Regards, Henk-Jan van Tuyl -- Folding@home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming --
participants (2)
-
Henk-Jan van Tuyl
-
Nathan Hüsken