April 27, 2024, 11:35:14 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Accelerators (hotkeys)

Started by LarryMc, June 10, 2011, 11:34:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

Anyone know a way (preferably easy) to disable hotkeys when a window is hidden?

I had thought about the windows got focus and lost focus messages.
If that would work then I know how to add the hot keys but I don't know how to delete them (that table they are in).

Reading code in the sdk doesn't make a whole lot of sense to me.

Any help would be appreciated.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

think I've got it working okay just by using set focus at the appropriate places.

still open to any other ideas though.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

sapero

Larry, try to save the "_ACCEL_TABLE" propery in OnHide event, set it to NULL, and later restore the property in OnShow handler.


sub handler ...
   case WM_SHOWWINDOW
      if @WPARAM then OnShow(*<WINDOW>@HITWINDOW) else OnHide(*<WINDOW>@HITWINDOW)
...
endsub

sub OnHide(WINDOW w)
   HANDLE acc = GetProp(w.hWnd, "_ACCEL_TABLE")
   if (acc)
      SetProp(w.hWnd, "_ACCEL_SAVE", acc)
      SetProp(w.hWnd, "_ACCEL_TABLE", 0)
   endif
endsub

sub OnShow(WINDOW win) ' call me from OnDestroy
   HANDLE acc = GetProp(w.hWnd, "_ACCEL_SAVE")
   if (acc)
      RemoveProp(w.hWnd, "_ACCEL_SAVE")
      SetProp(w.hWnd, "_ACCEL_TABLE", acc)
   endif
endsub

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library