[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
MENU HOOKS

     The Pull_Menu procedure allows a programmer to Hook a procedure
     directly into the core of the menu routines. The hooked procedure will
     be called every time the user presses a key during menu execution.
     This is a very powerful procedure that allows the programmer to
     customize the menu routines for a specific application.

     To use a procedure as a menu hook it must:

     1) Be a procedure declared with three passed parameters - a variable
     character, and two bytes. For example,

          PROCEDURE BOBS_HOOK(VAR C:CHAR;MAJ,MIN:BYTE);
          BEGIN
              .............
          END;

     2) Be declared as a far procedure, i.e. precede the procedure with a
     {$F+} compiler directive and succeed the procedure with the {$F-}
     compiler directive.

     The technique of assigning or hooking the procedure for Turbo Pascal
     5.0 is different from version 4.0:

     Turbo 5 Users - the PTTT variable includes a field HOOK which should
     be set to the procedure name, e.g.

          PTTT.HOOK := BOBS_HOOK;

     Turbo 4 Users - a global variable PM_UserHook (of type Pointer) should
     point to the procedure with the @ directive, e.g.

          PM_USERHOOK := @BOBS_HOOK

     The Hooked procedure will be passed the character the user just
     pressed, the currently highlighted main topic and sub-topic. The
     Hooked procedure can update the character pressed, and if the
     character is changed to a null (i.e. #0) then the menu session will be
     automatically terminated.

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson