Unit 'msemenus' Package
[Overview][Constants][Types][Classes][Procedures and functions][Index] [#msegui]

tmenuitems.itembyname

Looks up an item by name, e.g. mainmenu1.menu.itembyname('mnulogin').enabled:= false;

Declaration

Source position: msemenus.pas line 98

public function tmenuitems.itembyname(

  const name: ansistring

):tmenuitem;

Description

Looks up an item by name, e.g. mainmenu1.menu.itembyname('mnulogin').enabled:= false;. A nested submenu item can also be reached by chained indexing, e.g. mainmenu1.menu[0][0]. tmenuitem's many state flags are kept in the set property state (type actionstatesty); add a flag with state:= state + [as_disabled] and remove it with state:= state - [as_disabled] — the commonly used flags enabled, checked and visible are also available as plain boolean properties for convenience. To share behavior and state between a menu item and other widgets (e.g. a toolbar button), use a tcustomaction instead of setting properties on each item directly.


Documentation generated on: 2026-10-03