Using dynamically created menus...

From: Raptor (spammaps_at_moc.com)
Date: 12/14/04


Date: Tue, 14 Dec 2004 14:14:56 -0800

In my application, a user switches back and forth between
editing a treeview and text.

Rather than having one huge menu, with tree editing features
listed under a "Tree" main entry, I'm considering swapping
the
main menu entirely when either the treeview or the text gets
the focus. Assuming it's esthetically and psychologically
plausible, a couple of questions:

1. I've written code which creates menus from an array of
strings, specially formatted to indicate whether an entry
is a submenu of the previous entry. I first create the menu:

    MainMenu:= TMainMenu.Create(Self);

then loop through the strings to create the rest and assign
.Tag, .Caption and onClick values.

To switch menus, do I do a

    MainMenu.Destroy;

then create the new menu using the same process, though with
a different OnClick handler?

If so, could I simply put this line at the beginning of the
creation code:

    if MainMenu <> nil then MainMenu.Destroy;
    MainMenu:= TMainMenu.Create(Self);

2. How do I change the font color of these respective menus?

Raptor



Relevant Pages

  • Re: Using dynamically created menus...
    ... a user switches back and forth ... >> editing a treeview and text. ... Context switching should be no big deal, ...
    (alt.comp.lang.borland-delphi)
  • Re: Using dynamically created menus...
    ... > editing a treeview and text. ... > Rather than having one huge menu, with tree editing features ... When an item's Visible property is False it won't be displayed. ...
    (alt.comp.lang.borland-delphi)