Topic: Main menu

Hi,  can I insert a main menu in any form of my application? If so, how can I do it? Tks

Re: Main menu

Hello.


Yes you can, an example:
http://myvisualdatabase.com/forum/misc. … download=1

Dmitry.

Re: Main menu

hi mvd guru, I added my custom menu to a form. Is it possible to disable a menu item after selecting it? thank you

Re: Main menu

Hello.



procedure MenuClick1 (Sender: TObject);
begin
     ShowMessage('Hello from MyItem1');
     TMenuItem(Sender).Enabled := False;
end;
Dmitry.

Re: Main menu

Thanks Dmitry is perfect.

I wish I could re-enable him to press a button on the form... how can I do?
Thank you

Re: Main menu

Set some name for menu item when you creating it.

   MyItem1 := TMenuItem.Create (Form2);
   MyItem1.AutoHotKeys := maAutomatic;
   MyItem1.Caption := 'MyItem1';
   MyItem1.OnClick := @MenuClick1;
   MyItem1.Name := 'mniMyItem1'; //!!!

then you can find it by name

procedure Form2_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
    TMenuItem(Form2.FindComponent('mniMyItem1')).Enabled := False;
end;
Dmitry.

Re: Main menu

Thank you absolutely perfect.
Great Support Great program Dmitry