CT ON MENU

4D - Documentation   Français   English   German   4D Chart, Command Theme List   4D Chart, Command Alphabetical List   Back   Previous   Next

version 1


CT ON MENU (area; method)

ParameterTypeDescription
areaLongint4D Chart area
methodStringName of the method to call

Description

The CT ON MENU command executes method each time a menu command is activated in either the User or Custom Menus environments. The menu command can also be called by using the CT DO COMMAND command, as long as the menu command is called in method.

The called method returns three parameters:

ParameterDescription
$1A Long integer containing the ID for the 4D Chart area.
$2A Long integer containing the menu item number.
$3A Long integer containing the number of the modifier key pressed.

The $3 parameter corresponds to one of the following modifier keys (or combination of modifier keys):

ValueModifier Key
0No modifier
1Ctrl (Windows) or Command (Macintosh) key
2Shift key
4Alt (Windows) or Option (Macintosh) key
8Control key (Macintosh)

If a combination of modifier keys is pressed, the values are added together and passed as a parameter. For example, a value of 10 indicates that the user held down the Shift and Control keys while choosing a menu item.

If you plan to compile your database, you should declare the types of these parameters, as follows:

   C_LONGINT ($1;$2;$3)

Example

This example launches the MenuProc event method.

   CT ON MENU (Area;"MenuProc")

The MenuProc method controls the user's access to menu commands. If either the Save as Template or Properties menu command is selected, the user is presented with an alert and the menu selection is ignored. All other menu items are executed without interruption.

Following is the code for the MenuProc method.

   C_LONGINT ($1;$2;$3)
   Case of 
      : ($2=1006)  `Save as Template
         ALERT("You cannot save templates.")
      : ($2=2011)  `Properties
         ALERT("You do not have access to Properties.")
      Else 
         CT DO COMMAND (vArea;$2)
   End case 

See Also

Command Codes.


4D - Documentation   Français   English   German   4D Chart, Command Theme List   4D Chart, Command Alphabetical List   Back   Previous   Next