Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - <b>end accelerators</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
END ACCELERATORS
Finish the definition of accelerator keys
------------------------------------------------------------------------------

Syntax
#include "accel.ch"
END ACCELERATORS

Arguments
None.

Description
This command marks the end of the definitions of accelerator
(short-cut) keys.

The start of the accelerators is marked by the ACCELERATORS
command, the individual accelerator key combinations are made
using the AKEY command, and the end of the definitions is
marked by END ACCELERATORS.

The definitions are built up in the AccelKeyList variable,
which is usually declared as a LOCAL.

After the END ACCELERATORS command, the accelerators can be
activated by the USE ACCELERATORS command.

You can also load an accelerator table from a resource file,
using the LoadAccelerators() function.

See the AKEY command for an explanation of how accelerators
are used.

Example
#include "accel.ch"
#define   ID_HELP   1000      // must use id's over 500
#define   ID_FIND   1001
#define   ID_COPY   1011
#define   ID_PASTE  1012

local     AccelKeyList

ACCELERATORS

AKEY VK_F1,    ID_HELP,  VIRTKEY             // F1
AKEY VK_F4,    ID_FIND,  VIRTKEY, SHIFT      // Shift-F4
// you can do Control-Key like this:
AKEY "^V",          ID_PASTE                 // Control-V
// or like this:
AKEY "C",      ID_COPY,  CONTROL             // Control-C

END ACCELERATORS

USE ACCELERATORS

// . . .

// here is an example of handling some accelerators:
do while .t.
     do while (nEvent := ChkEvent()) == EVENT_NONE
     enddo
     do case
     case nEvent == EVENT_ACCELKEY
          DoAccelerators()
     // . . .
     endcase
enddo


procedure DoAccelerators()
local     nId := _LastwParam()
do case
case nId == ID_HELP
     DoHelp()
case nId == ID_FIND
     DoFind()
case nId == ID_COPY
     // same as menu item Edit...Copy  (with id "copy")
     eval( GetMenuBlock( hMenu, "copy" ) )
case nId == ID_PASTE
     // same as menu item Edit...Paste  (with id "paste")
     eval( GetMenuBlock( hMenu, "paste" ) )
endcase
return


See Also: ACCELERATORS AKEY LoadAccelerators() USE ACCELERATORS

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson