Saturday, June 05, 2004

Useful tidbit on supporting right-clicks

On many keyboards today, they all have a shortcut key for the right-click menu.
 
This doesn't automatically fire the Right-click menu option (although most people think it should)
 
The keycode is 93. So if you want to support it, just put the following into the KeyDown or Keypress method:
 
IF keycode = 93
    THIS.RightClick()
ENDIF
 
Be warned though - you can't use the traditional MROW() and MCOL() because the mouse cursor may not be where the focus really is. You may want to try passing a secondary parameter to identify the true starting row and column.
 
Method RightClick
LPARAMETERS tlKey
 
IF NOT tlKey
    DEFINE POPUP SHORTCUT SHORTCUT FROM MROW(), MCOL()
ELSE
    ** Figure out where you are
    newx = ROW()
    newy = COL()
    DEFINE POPUP SHORTCUT SHORTCUT FROM newx,newy
ENDIF

No comments: