InitMenuItems

Far Manager

InitMenuItems

The InitMenuItems function translates an array of InitMenuItem structures to an array of FarMenuItem structures.

Attention! Attention!

  • The InitMenuItems function is not part of the standard API.
void InitMenuItems(
         const struct InitMenuItem *Init,
         struct FarMenuItem *Item,
         int ItemsNumber)
{
  int I;
  struct FarMenuItem *PItem=Item;
  const struct InitMenuItem *PInit=Init;
  for (I=0; I < ItemsNumber; I++,PItem++,PInit++)
  {
    PItem->Selected=PInit->Selected;
    PItem->Checked=PInit->Checked;
    PItem->Separator=PInit->Separator;
    if ((unsigned int)PInit->Text < 2000)
      strcpy(PItem->Text,GetMsg((unsigned int)PInit->Text));
    else
      strcpy(PItem->Text,PInit->Text);
  }
}

Parameters

Init
Pointer to an array of InitMenuItem structures. Each array item defines one menu item.
Item
Pointer to an array of FarMenuItem structures to initialize. Each array item defines one menu item.
ItemsNumber
Number of elements in Init.

Return value

None.

Remarks

Use of the InitMenuItems function is reasoned by the following:
FarMenuItem.Text variable is large, that's why direct initalization of an array of FarMenuItem structures may significantly increase memory usage.

Example bellow shows how to use the InitMenuItems function and the InitMenuItem structure to create a menu.

See also: