From: Milind G. <mil...@gm...> - 2012-06-21 21:54:00
|
I see if the panel and frame both have key press events associated I can catch all keys. So now if I can associate the key press event with all my sub windows in the frame it should work. I tried the Recursive technique they have here: http://wiki.wxwidgets.org/Catching_key_events_globally using the code: function connectKeyUpEvent(win) if win then win:Connect(wx.wxID_ANY, wx.wxEVT_KEY_UP, CharKeyEvent) local childNode = win:GetChildren():GetFirst() while childNode do connectKeyUpEvent(childNode:GetData()) childNode = childNode:GetNext() end end end connectKeyUpEvent(frame) But it creates and error saying unknown method Connect for a type wxObject. I thought of checking win.Connect if it exists before calling Connect but that gives the same error during the check itself. I then tried calling win:Connect using pcall but that gives another error: bad argument#1 to pcall (value expected) So right now I am stuck with this method. I will try other methods they have mentioned. Thanks, Milind On Thu, Jun 21, 2012 at 2:38 PM, Milind Gupta <mil...@gm...>wrote: > I was trying out some of the codes in veryminimal example and I notice > another strange thing. The program crashes as soon as I take my mouse > pointer over the frame. I have attached the code. Its the same as in the > examples though. Has anyone seen this before? Other examples just run fine. > I am not sure why this one crashes? I am on a windows 7 machine. > > > On Thu, Jun 21, 2012 at 10:51 AM, John Labenski <jla...@gm...>wrote: > >> On Thu, Jun 21, 2012 at 2:36 AM, Milind Gupta <mil...@gm...> >> wrote: >> > Thank you Andre and John for your replies. I haven't tried the code >> Andre >> > gave. I am looking to catch keys other than accelerator keys. I want to >> have >> >> Try it... >> >> > keys assigned dynamically at run time to certain lua scripts and then >> catch >> > those keys to execute the scripts. So is this a wxWidgets issue or this >> is >> > something not working right in wxLua? >> >> It doesn't seem like there is an issue with anything, you have already >> been shown multiple examples that do exactly what it seems to me like >> you're looking to do... Maybe it's not clear to me though, but I'm >> sure if you try some of the examples you'll get a better idea of how >> it the key events work. >> >> If you do find a problem please try to explain it and post code to >> demonstrate it. >> >> Regards, >> John >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> wxlua-users mailing list >> wxl...@li... >> https://lists.sourceforge.net/lists/listinfo/wxlua-users >> > > |