Current location - Recipe Complete Network - Complete cookbook of home-style dishes - The problem of dynamically loading menu with Delphi
The problem of dynamically loading menu with Delphi
That requires dynamic association of events and menus, which is more troublesome.

You can design to hide all the menus and then display the existing menus in the database (l.Strings[k] is the menu in the database. )

//Display the menu within the permission range.

For i:=0 to FMain. MainMenu 1。 Items.Count- 1 do

begin

For j:=0 to FMain. MainMenu 1。 Item [i]. Count- 1 do

begin

FMain。 MainMenu 1。 Item [i]. Item [j]. Visible: = false;

For k:=0 to l.Count- 1 do.

begin

If FMain. MainMenu 1。 Item [i]. Item [j]. Then the string [k]

begin

FMain。 MainMenu 1。 Item [i]. Item [j]. Visible: = true;

Break;

End;

End;

End;

End;