int WINAPI Menu( int PluginNumber, int X, int Y, int MaxHeight, DWORD Flags, const char *Title, const char *Bottom, const char *HelpTopic, const int *BreakKeys, int *BreakCode, const struct FarMenuItem *Item, int ItemsNumber );
-10.| Constant | Description |
|---|---|
| FMENU_AUTOHIGHLIGHT | If specified, item hot keys will be assigned automatically, beginning from the first item. |
| FMENU_CHANGECONSOLETITLE | If specified, the the title of the console window will be set to Title (if Title is not empty). |
| FMENU_SHOWAMPERSAND | Shows ampersands in menu item texts. Without this flags ampersands are used to specify item hot keys. |
| FMENU_REVERSEAUTOHIGHLIGHT | If specified, item hot keys will be assigned automatically, beginning from the last item. |
| FMENU_USEEXT | Instead of FarMenuItem the FarMenuItemEx structure is used. |
| FMENU_WRAPMODE | If specified, attempts to move the cursor above the first item
or below the last will move the cursor to the last or the first item, respectively.
It is recommended to always set this flag, unless you have specific reasons not to do so. |
struct FarMenuItemEx FooEx[]={
...
};
Info.Menu(...,FMENU_USEEXT|...,(const struct FarMenuItem *)FooEx,...)
NULL if menu title is not needed.NULL if menu bottom title
is not needed.NULL if help is not needed.NULL. The high word of an array item can be either 0 or a
combination of PKF_CONTROL, PKF_ALT and PKF_SHIFT flags
to describe corresponding key combinations.
For example in the MultiArc plugin in the "Archive commands" menu (Shift-F3 on archive) the F4 keystroke is processed in the following way:
int BreakCode;
int BreakKeys[2]={VK_F4,0};
ExitCode=Info.Menu(Info.ModuleNumber,-1,-1,0,FMENU_USEEXT|FMENU_WRAPMODE,
GetMsg(MArcCmdTitle),GetMsg(MSelectF4),"ArcCmd",BreakKeys,&BreakCode,
(struct FarMenuItem *)MenuItems,Count);
if(ExitCode>=0)
{
if(BreakCode == 0) // F4 pressed
{
GetFormatName(MenuItems[0].Text.Text);
ConfigCommands(MenuItems[0].Text.Text,2+MenuData[ExitCode].Cmd*2);
continue;
}
}
else
return FALSE;
NULL.struct FarMenuItem MenuItems[2];
memset(MenuItems,0,sizeof(MenuItems));
strcpy(MenuItems[0].Text,GetMsg(MCaseLower));
strcpy(MenuItems[1].Text,GetMsg(MCaseUpper));
MenuItems[0].Selected=TRUE;
int MenuCode=Info.Menu(Info.ModuleNumber,-1,-
1,0,FMENU_AUTOHIGHLIGHT|FMENU_WRAPMODE,
GetMsg(MCaseConversion),NULL,
"Contents",NULL,NULL,
MenuItems,
sizeof(MenuItems)/sizeof(MenuItems[0]));
if (MenuCode<0)
return(INVALID_HANDLE_VALUE);
. . .
Info is defined as a global variable:
struct PluginStartupInfo Info;...and is initialized in the SetStartupInfo function:
void WINAPI _export SetStartupInfo(struct PluginStartupInfo *Info)
{
...
::Info=*Info;
...
}