Menu help

Function help:

Real API_Menu_Create ();

This function creates a new menu and returns the handle.

Return value:
Returns a menu handle when succesful, or zero (0) otherwise.

Real API_Menu_CreatePopup ();

This function creates a new popup menu and returns the handle.

Return value:
Returns a popup menu handle when succesful, or zero (0) otherwise.

Real API_Menu_AddString (Real Parent Menu Handle, String Text, Real Bitmap Resource Handle, Real Item Position);

This function adds a new menu item, containing text and optional a bitmap to the specified parent menu.

The item position is the position of the menu item relative to the other menu items. The item will be added to the end of the parent menu if you don't specify this argument.

argument2 or argument3 can be set to zero (0) if you don't want to specify them.

Return value:
Returns the menu item id when succesful or zero (0) otherwise.

Real API_Menu_AddMenu (Real Parent Menu Handle,Real Popup Menu Handle, String Text);

This function adds a popup menu to a parent menu using the specified text.

Return value:
Returns the menu id when succesful or zero (0) otherwise.
Real API_Menu_AddSeparator (Real Parent Menu Handle,Real Item position);

This function adds a popup menu to a parent menu using the specified text.

The item position is the position of the menu item relative to the other menu items. The item will be added to the end of the parent menu if you don't specify this argument.

Return value:
Returns the menu id when succesful or zero (0) otherwise.

Real API_Menu_Set (Real Window Handle, Real Menu Handle);

This function adds a menu to a window.

Return value:
Returns true (1) when succesful or false (0) otherwise.
Real API_Menu_Get (Real Window Handle);

This function returns the menu handle of the menu assigned to a window.

Return value:
Returns the menu handle when succesful or false (0) otherwise.
Real API_Menu_SetCheckBitmaps (Real Menu Item ID, Real Unchecked Bitmap Resource Handle, Real Checked Bitmap Resource Handle);

This function sets the bitmaps of menu item for the checked and unchecked states.

Return value:
Returns true (1) when succesful or false (0) otherwise.
Real API_Menu_RemoveItem (Real Menu Item ID);

This function removes a menu item.

Return value:
Returns true (1) when succesful or false (0) otherwise.
Real API_Menu_RemoveMenu (Real Menu Handle);

This function removes a menu from it's parent.

Return value:
Returns true (1) when succesful or false (0) otherwise.
Real API_Menu_SetItemText (Real Menu Item ID, String Text);

This function changes the text of a menu item.

Return value:
Returns true (1) when succesful or false (0) otherwise.

Real API_Menu_SetItemState (Real Menu Item ID, Real State Flags);

This function changes the state of a menu item.

You can use the menu item state flags for argument1.

Return value:
Returns true (1) when succesful or false (0) otherwise.


Real API_Menu_SetItemBitmap (Real Menu Item ID, Real Bitmap Resource Handle);

This function assigns a bitmap to a menu item.

Return value:
Returns true (1) when succesful or false (0) otherwise


Real API_Menu_SetItemHilited (Real Menu Item ID, Real Is Hilited);

This function hilites (argument 1 is set to 1) or unhilites (argument1 is set to 0) a menu item.

Return value:
Returns true (1) when succesful or false (0) otherwise.


Real API_Menu_SetItemEnabled (Real Menu Item ID, Real Is Enabled);

This function enables (argument 1 is set to 1) or disables (argument1 is set to 0) a menu item.

Return value:
Returns true (1) when succesful or false (0) otherwise


Real API_Menu_GetItemBitmap (Real Menu Item ID);

This function returns the resource handle of the bitmap assigned to a menu item.

Return value:
Returns the bitmap resource handle when succesful or false (0) otherwise


Real API_Menu_GetItemHilited (Real Menu Item ID);

This function returns wether a menu item is hilited.

Return value:
Returns 1 when the item is hilited, 0 when not.


Real API_Menu_GetItemEnabled (Real Menu Item ID);

This function returns wether a menu item is enabled.

Return value:
Returns 1 when the item is enabled, 0 when not.


Real API_Menu_SetItemRadioChecked (Real First Menu Item ID, Real Last Menu Item ID, Real Menu Item ID);

This function builds a radio group of items and sets the initial selected item.

(argument0): First Menu Item ID: The first menu item in the radio group.
(argument1): First Menu Item ID: The first menu item in the radio group.
(argument2): The item that has to be selected after calling this function.

Return value:
Returns true (1) when succesful or false (0) otherwise


Real API_Menu_SetItemChecked (Real First Menu Item ID, Real Is Checked);

This function checks (argument1 is set to 1) or unchecks (argument1 is set to 0) the menu item.

Return value:
Returns true (1) when succesful or false (0) otherwise.


Real API_Menu_SetBrush (Real Menu Handle, Real Brush Resource Handle);

This function sets the brush of a menu or popup menu.

Return value:
Returns true (1) when succesful or false (0) otherwise.


Real API_Menu_SetMaxHeight (Real Menu Handle, Real Brush Resource Handle);

This function sets the maximum height of a menu.

Return value:
Returns true (1) when succesful or false (0) otherwise.


Real API_Menu_ShowPopup (Real Menu Handle, Real Window Handle, Real Flags, Real X, Real Y);

This function shows a popup menu.

argument2 uses the following flags: (set argument2 to -1 to use TPM_RETURNCMD|TPM_LEFTALIGN)

TPM_CENTERALIGN
If this flag is set, the function centers the shortcut menu horizontally relative to the coordinate specified by the x parameter.
TPM_LEFTALIGN
If this flag is set, the function positions the shortcut menu so that its left side is aligned with the coordinate specified by the x parameter.
TPM_RIGHTALIGN
Positions the shortcut menu so that its right side is aligned with the coordinate specified by the x parameter.

Use one of the following flags to specify how the function positions the shortcut menu vertically.

TPM_BOTTOMALIGN
If this flag is set, the function positions the shortcut menu so that its bottom side is aligned with the coordinate specified by the y parameter.
TPM_TOPALIGN
If this flag is set, the function positions the shortcut menu so that its top side is aligned with the coordinate specified by the y parameter.
TPM_VCENTERALIGN
If this flag is set, the function centers the shortcut menu vertically relative to the coordinate specified by the y parameter.

Use the following flags to determine the user selection without having to set up a parent window for the menu.
TPM_NONOTIFY
If this flag is set, the function does not send check commands when the user clicks on a menu item.
TPM_RETURNCMD
If this flag is set, the function returns the menu item identifier of the user's selection in the return value.

Use one of the following flags to specify which mouse button the shortcut menu tracks.

TPM_LEFTBUTTON
If this flag is set, the user can select menu items with only the left mouse button.
TPM_RIGHTBUTTON
If this flag is set, the user can select menu items with both the left and right mouse buttons.

Windows 98/Me, Windows 2000/XP:Use any reasonable combination of the following flags to modify the animation of a menu. For example, by selecting a horizontal and a vertical flag you can achieve diagonal animation.

TPM_HORNEGANIMATION
Animates the menu from right to left.
TPM_HORPOSANIMATION
Animates the menu from left to right.
TPM_NOANIMATION
Displays menu without animation.
TPM_VERNEGANIMATION
Animates the menu from bottom to top.
TPM_VERPOSANIMATION
Animates the menu from top to bottom.

Set argument3 and argument4 to 0 to use the mouse position as X and Y axis.

Return value:
Returns the selected menu item ID when succesful (if the TPM_RETURNCMD) is set or false (0) otherwise.



Example code:

is
Menu = API_Menu_Create ();
Menu_File = API_Menu_CreatePopup ();

API_Menu_SetBrush (Menu_File,API_Draw_CreateSolidBrush (c_red));

API_Menu_AddMenu (Menu,Menu_File,"&File");

Menu_File_New = API_Menu_AddString (Menu_File,"&New");
Menu_File_Open = API_Menu_AddString (Menu_File,"&Open");
Menu_File_Close = API_Menu_AddString (Menu_File,"&Close");
API_Menu_AddSeparator (Menu_File);
Menu_File_Save = API_Menu_AddString (Menu_File,"&Save");
Menu_File_SaveAs = API_Menu_AddString (Menu_File,"&Save As ... ");
API_Menu_AddSeparator (Menu_File);
Menu_File_Exit = API_Menu_AddString (Menu_File,"&Exit");

API_Menu_SetBrush (Menu,API_Draw_CreateSolidBrush (c_red));

API_Menu_Set (Win2,Menu);


Return to help index