On 1/2/11 5:45 PM, OKB (not okblacke) wrote: > Ed Leafe wrote: > >> On Jan 2, 2011, at 8:29 PM, OKB (not okblacke) wrote: >> >>> I can't seem to catch a KeyDown event (or any KeyEvents >>> that I've >>> tried). I have a class that subclasses dPanel, and in that >>> class's afterInit I do: >>> >>> self.bindEvent(dabo.dEvents.KeyDown, self.keyDown) >>> >>> . . . my keyDown method is still not called when I press keys. Is >>> there something else I need to do? I also tried doing >>> self.Form.bindEvent instead, but it didn't work either. >> >> That's the right way to bind events, but I'm not sure that >> panels can receive key events. I believe that only controls >> that can receive focus get key events. > > Ah, I now tried doing self.Application.bindEvent instead, and that > worked. However, it's not ideal for my purpose, since I assume it's > setting it globally for the app.
It isn't that it is setting it globally for the entire app, not exactly. What happens is that when you press a key, if that control doesn't handle it, and nothing in the containership handles it, then the application object has a chance to handle it. > The deal is that I have a dPageFrameNoTabs where, based on stuff > the user does, focus changes to a new panel. The individual pages are > dPanels. The page-frame occupies the entire form, so the entirety of > the interface the user sees is always a single panel of the form. So is > there a way to bind a KeyEvent in such a way that it is caught only when > a certain panel is chosen? Or would I have to bind it on the App and > then manually check what panel is selected? You could bind to the app object temporarily, just while the panel is visible, and unbind after... Paul _______________________________________________ Post Messages to: Dabo-users@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/4d48486c.6000...@ulmcnett.com