FarMenuItemEx
The FarMenuItemEx structure describes a single menu item.
An array of structures of this type is passed to the Menu function.
In order to use the FarMenuItemEx structure the FMENU_USEEXT
flag should be set when the Menu function is called.
struct FarMenuItemEx { DWORD Flags; union { char Text[128]; const char *TextPtr; } Text; DWORD AccelKey; DWORD Reserved; DWORD_PTR UserData; };
Elements
Flags
Combination of the following values (the FARMENUFLAGS enumeration):
Flag | Description |
---|---|
MIF_SELECTED | Denotes a selected menu item. Only one item can be selected. |
MIF_CHECKED | Denotes a checked menu item. Check sign will be shown near the item. |
MIF_SEPARATOR | The menu item is shown as delimiter. Unlike in the FarMenuItem structure, the delimiter can contain text. The text is center-aligned and is not selectable. |
MIF_DISABLE | Denotes a disabled menu item. |
MIF_GRAYED | If this flag is set, the menu item is shown, but cannot be selected. |
MIF_HIDDEN | If this flag is set, the menu item is not shown. |
MIF_USETEXTPTR | The menu item uses the Text.TextPtr field. |
Text.Text
The text of the menu item.
Text.TextPtr
A pointer to the menu item text.
Used in conjunction with the MIF_USETEXTPTR flag,
if the Text.Text array has insufficient size or
a string from a language file is used, for example:
struct FarMenuItemEx Item; Item.Flags=MIF_USETEXTPTR; Item.Text.TextPtr=Info.GetMsg(Info.ModuleNumber,MFooItem);
AccelKey
The FAR Manager key code
which will be used to activate the menu item. Example: in the "Commands" menu pressing
Ctrl-O is used to the select the "Panels On/Off" menu item.
As opposed to the BreakKeys parameter of the Menu
function, the AccelKey field is analogous to the hotkey.
Reserved
Reserved for future use, should be set to 0.
UserData
User data associated with the menu item. FAR Manager does not use this field.
Remarks
- In the low order word of the Flags a field character code can be specified which will be displayed as the check mark. In this case, FAR will automatically set the MIF_CHECKED flag for this menu item.
- If the low order word of the Flags field is 0 and the MIF_CHECKED flag is set,
or if the low order word of the Flags field is 1,
then the default check mark will be displayed: the character with code 0FBh (
√
). - If the MIF_SEPARATOR flag is used without text, the Text.Text or Text.TextPtr
fields should be initialized to 0, for example:
struct FarMenuItemEx Item; Item.Flags=MIF_SEPARATOR; Item.Text.Text[0]=0;
or:
struct FarMenuItemEx Item; Item.Flags=MIF_SEPARATOR|MIF_USETEXTPTR; Item.Text.TextPtr=NULL;
See also: