Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>



Inserting, updating a menu item at runtime
When inserting or updating a menu item at runtime, do this with BeginUpdate / EndUpdate calls. This is a requirement due to an optimization for visual updates when the menu stylers are used. Following sample code snippet shows how to add a new menu item at runtime:
var mnu: TMenuItem; begin AdvMainMenu1.BeginUpdate; mnu := TMenuItem.Create(self); mnu.Caption := 'New item'; AdvMainMenu1.Items[1].Insert(0,mnu); AdvMainMenu1.EndUpdate; end;