Delphi .NET (2) Database (71) Delphi IDE (90) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280)
Exchange Links About this site Links to us 
|
Have a menu in any form
This article has not been rated yet. After reading, feel free to leave comments and rate it.
When I was working on the expert for TMultiLang, I needed to display a menu in the expert's "main" form.
Now this form was created with TForm1.Create() and therefore not an application's main window.
This means:
Although the menu is displayed in design mode properly, at runtime it will not appear.
Even manually assigning the menu with Menu := MainMenu will not help.
Workaround:
Use the API function SetMenu in the FormCreate handler as shown below:
 | |  | |
procedure TForm1.FormCreate(Sender: TObject);
var
h : integer;
begin
h := ClientHeight;
SetMenu (Handle, MainMenu1.Handle);
ClientHeight := h;
end; | |  | |  |
Comments:
|