IonicWind Software

IWBasic => GUI Central => Topic started by: LarryMc on June 10, 2011, 11:34:53 PM

Title: Accelerators (hotkeys)
Post by: LarryMc on June 10, 2011, 11:34:53 PM
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
Title: Re: Accelerators (hotkeys)
Post by: LarryMc on June 10, 2011, 11:52:51 PM
think I've got it working okay just by using set focus at the appropriate places.

still open to any other ideas though.

LarryMc
Title: Re: Accelerators (hotkeys)
Post by: sapero on June 11, 2011, 02:00:14 AM
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
Title: Re: Accelerators (hotkeys)
Post by: LarryMc on June 11, 2011, 07:13:49 AM
thanks Sapero