mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-08 22:58:13 +02:00
fixed crash in new menueditor
git-svn-id: trunk@4036 -
This commit is contained in:
parent
f2c5eb5c99
commit
c6f9b10d5d
@ -36,8 +36,8 @@ unit MenuEditorForm;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,
|
Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs, LResources,
|
||||||
Buttons, ExtCtrls, LMessages, DesignerMenu, Menus, GraphType,
|
StdCtrls, Buttons, ExtCtrls, LMessages, DesignerMenu, Menus, GraphType,
|
||||||
ComponentEditors;
|
ComponentEditors;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -45,7 +45,6 @@ type
|
|||||||
TMainMenuEditorForm = class(TForm)
|
TMainMenuEditorForm = class(TForm)
|
||||||
private
|
private
|
||||||
FDesignerMainMenu: TDesignerMainMenu;
|
FDesignerMainMenu: TDesignerMainMenu;
|
||||||
FCanvas: TCanvas;
|
|
||||||
public
|
public
|
||||||
constructor CreateWithMenu(TheOwner: TComponent; AMenu: TMainMenu);
|
constructor CreateWithMenu(TheOwner: TComponent; AMenu: TMainMenu);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -54,7 +53,6 @@ type
|
|||||||
Shift: TShiftState; X,Y: Integer);
|
Shift: TShiftState; X,Y: Integer);
|
||||||
property DesignerMainMenu: TDesignerMainMenu read FDesignerMainMenu
|
property DesignerMainMenu: TDesignerMainMenu read FDesignerMainMenu
|
||||||
write FDesignerMainMenu;
|
write FDesignerMainMenu;
|
||||||
property Canvas: TCanvas read FCanvas write FCanvas;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TMenuComponentEditor
|
{ TMenuComponentEditor
|
||||||
@ -78,15 +76,15 @@ constructor TMainMenuEditorForm.CreateWithMenu(TheOwner: TComponent;
|
|||||||
AMenu: TMainMenu);
|
AMenu: TMainMenu);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
Canvas:=inherited Canvas;
|
width:=800;
|
||||||
self.width:=800;
|
height:=600;
|
||||||
self.height:=600;
|
position:=poDesktopCenter;
|
||||||
self.position:=poDesktopCenter;
|
OnMouseDown:=@MouseDownClick;
|
||||||
self.OnMouseDown:=@MouseDownClick;
|
|
||||||
|
|
||||||
DesignerMainMenu:=TDesignerMainMenu.CreateWithMenu(Self,AMenu);
|
DesignerMainMenu:=TDesignerMainMenu.CreateWithMenu(Self,AMenu);
|
||||||
with DesignerMainMenu do
|
with DesignerMainMenu do
|
||||||
begin
|
begin
|
||||||
|
Parent:=Self;
|
||||||
LoadMainMenu;
|
LoadMainMenu;
|
||||||
SetCoordinates(1,1,DesignerMainMenu.Root);
|
SetCoordinates(1,1,DesignerMainMenu.Root);
|
||||||
end;
|
end;
|
||||||
@ -127,27 +125,35 @@ var
|
|||||||
begin
|
begin
|
||||||
inherited Create(AComponent,ADesigner);
|
inherited Create(AComponent,ADesigner);
|
||||||
Menu:=TMainMenu.Create(AComponent);
|
Menu:=TMainMenu.Create(AComponent);
|
||||||
|
|
||||||
m1:=TMenuItem.Create(AComponent);
|
m1:=TMenuItem.Create(AComponent);
|
||||||
m1.Caption:='File';
|
m1.Caption:='File';
|
||||||
Menu.Items.Add(m1);
|
Menu.Items.Add(m1);
|
||||||
|
|
||||||
m2:=TMenuItem.Create(AComponent);
|
m2:=TMenuItem.Create(AComponent);
|
||||||
m2.Caption:='Power';
|
m2.Caption:='Power';
|
||||||
Menu.Items.Add(m2);
|
Menu.Items.Add(m2);
|
||||||
|
|
||||||
m3:=TMenuItem.Create(AComponent);
|
m3:=TMenuItem.Create(AComponent);
|
||||||
m3.Caption:='Settings';
|
m3.Caption:='Settings';
|
||||||
Menu.Items.Add(m3);
|
Menu.Items.Add(m3);
|
||||||
|
|
||||||
m4:=TMenuItem.Create(AComponent);
|
m4:=TMenuItem.Create(AComponent);
|
||||||
m4.Caption:='New';
|
m4.Caption:='New';
|
||||||
m1.Add(m4);
|
m1.Add(m4);
|
||||||
|
|
||||||
m5:=TMenuItem.Create(AComponent);
|
m5:=TMenuItem.Create(AComponent);
|
||||||
m5.Caption:='Wizard';
|
m5.Caption:='Wizard';
|
||||||
m1.Add(m5);
|
m1.Add(m5);
|
||||||
|
|
||||||
m6:=TMenuItem.Create(AComponent);
|
m6:=TMenuItem.Create(AComponent);
|
||||||
m6.Caption:='Project';
|
m6.Caption:='Project';
|
||||||
m5.Add(m6);
|
m5.Add(m6);
|
||||||
|
|
||||||
m7:=TMenuItem.Create(AComponent);
|
m7:=TMenuItem.Create(AComponent);
|
||||||
m7.Caption:='Power On';
|
m7.Caption:='Power On';
|
||||||
m2.Add(m7);
|
m2.Add(m7);
|
||||||
|
|
||||||
m8:=TMenuItem.Create(AComponent);
|
m8:=TMenuItem.Create(AComponent);
|
||||||
m8.Caption:='Another Caption';
|
m8.Caption:='Another Caption';
|
||||||
m6.Add(m8);
|
m6.Add(m8);
|
||||||
@ -157,6 +163,7 @@ procedure TMainMenuComponentEditor.Edit;
|
|||||||
var
|
var
|
||||||
MainMenuEditorForm: TMainMenuEditorForm;
|
MainMenuEditorForm: TMainMenuEditorForm;
|
||||||
begin
|
begin
|
||||||
|
if Menu=nil then RaiseGDBException('TMainMenuComponentEditor.Edit Menu=nil');
|
||||||
MainMenuEditorForm:=TMainMenuEditorForm.CreateWithMenu(Application,Menu);
|
MainMenuEditorForm:=TMainMenuEditorForm.CreateWithMenu(Application,Menu);
|
||||||
MainMenuEditorForm.ShowModal;
|
MainMenuEditorForm.ShowModal;
|
||||||
MainMenuEditorForm.Free;
|
MainMenuEditorForm.Free;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{ $Id$ }
|
{ $Id$ }
|
||||||
{
|
{
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
pkgmanager.pas
|
pkggraphexplorer.pas
|
||||||
--------------
|
--------------------
|
||||||
|
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user