From 74f4e66f0fd7ddb33b7de9e8dde97d84ccc6a4bd Mon Sep 17 00:00:00 2001 From: lazarus Date: Sat, 6 Jan 2001 06:28:48 +0000 Subject: [PATCH] Made Designer control the control movement and such. I am now using ISDesignMsg to move the controls. Shane git-svn-id: trunk@100 - --- Makefile | 7 +- designer/designer.pp | 304 +++++++++++++++++++++++++++++++++++++++- ide/customformeditor.pp | 13 +- ide/main.pp | 94 ++++++++----- 4 files changed, 376 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index bef19ba5b0..07d604b009 100644 --- a/Makefile +++ b/Makefile @@ -168,7 +168,7 @@ endif # Targets -override DIROBJECTS+=$(wildcard lcl components) +override DIROBJECTS+=$(wildcard lcl components designer) override EXEOBJECTS+=lazarus # Clean @@ -1362,7 +1362,7 @@ endif # Dir components ifdef OBJECTDIRCOMPONENTS -.PHONY: components_all components_debug components_examples components_test components_smart components_shared components_showinstall components_install components_sourceinstall components_exampleinstall components_zipinstall components_zipsourceinstall components_zipexampleinstall components_clean components_distclean components_cleanall components_require components_info +.PHONY: components_all components_debug components_examples components_test components_smart components_shared components_showinstall components_install components_sourceinstall components_exampleinstall components_zipinstall components_zipsourceinstall components_zipexampleinstall components_clean components_distclean components_cleanall components_require components_info designer_clean components_all: $(MAKE) -C components all @@ -1417,6 +1417,9 @@ components_require: components_info: $(MAKE) -C components info + +designer_clean: + $(MAKE) -C designer clean endif ##################################################################### diff --git a/designer/designer.pp b/designer/designer.pp index 9200aaf261..997a730edf 100644 --- a/designer/designer.pp +++ b/designer/designer.pp @@ -25,7 +25,7 @@ unit designer; interface uses - classes, Forms, controls, lmessages, graphics, ControlSelection, FormEditor, UnitEditor; + classes, Forms, controls, lmessages, graphics, ControlSelection, CustomFormEditor,FormEditor, UnitEditor,Main; type TGridPoint = record @@ -38,9 +38,17 @@ type FCustomForm: TCustomForm; FFormEditor : TFormEditor; FSourceEditor : TSourceEditor; + FMainIDE : TMainIDE; function GetIsControl: Boolean; procedure SetIsControl(Value: Boolean); protected + MouseDownControl : TObject; + MouseDownPos, MouseUpPos, LastMouseMovePos : TPoint; + + Procedure MouseDownOnControl(Sender : TControl; Message : TLMessage); + procedure MouseMoveOnControl(Sender : TControl; var Message : TLMessage); + Procedure MouseUpOnControl(Sender : TControl; Message:TLMessage); + public ControlSelection : TControlSelection; constructor Create(customform : TCustomform); @@ -54,21 +62,29 @@ type procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure PaintGrid; override; procedure ValidateRename(AComponent: TComponent; const CurName, NewName: string); override; + Procedure SelectOnlyThisComponent(AComponent:TComponent); + + procedure MouseUpOnForm(Sender : TObject; Button: TMouseButton; + Shift : TShiftState; X, Y: Integer); + procedure MouseDownOnForm(Sender : TObject; Button: TMouseButton; + Shift : TShiftState; X, Y: Integer); + procedure MouseMoveOnForm(Sender : TObject; Shift : TShiftState; X, Y: Integer); + property IsControl: Boolean read GetIsControl write SetIsControl; property Form: TCustomForm read FCustomForm write FCustomForm; property FormEditor : TFormEditor read FFormEditor write FFormEditor; property SourceEditor : TSourceEditor read FSourceEditor write FSourceEditor; + property MainIDE : TMainIDE read FMainIDE write FMainIDE; end; implementation uses - Sysutils, Typinfo; + Sysutils, Typinfo,Math; var GridPoints : TGridPoint; - constructor TDesigner.Create(CustomForm : TCustomForm); var nmUnit : String; @@ -96,15 +112,295 @@ begin end; +procedure TDesigner.SelectOnlyThisComponent(AComponent:TComponent); +begin + ControlSelection.Clear; + ControlSelection.Add(TControl(AComponent)); + + FFormEditor.ClearSelected; + // this will automatically inform the object inspector + FFormEditor.AddSelected(AComponent); +end; + + +procedure TDesigner.MouseDownOnForm(Sender : TObject; Button: TMouseButton; +Shift : TShiftState; X, Y: Integer); +Begin +Writeln('MOUSEDOWNONFORM'); + if GetCaptureGrabber<>nil then exit; + + MouseDownPos.X := X; + MouseDownPos.Y := Y; + MouseDownControl:=Sender; + LastMouseMovePos:=MouseDownPos; + +End; + +procedure TDesigner.MouseMoveOnForm(Sender : TObject; +Shift : TShiftState; X, Y: Integer); +var + CurDesigner: TDesigner; + CaptureGrabber:TGrabber; +Begin + CaptureGrabber:=GetCaptureGrabber; + if CaptureGrabber<>nil then begin + CaptureGrabber.CaptureMouseMove(TControl(Sender),Shift,X,Y); + end else begin + + if Assigned(MouseDownControl) then begin + LastMouseMovePos:=Point(X,Y); + end; + end; +End; + +procedure TDesigner.MouseUpOnForm(Sender : TObject; Button: TMouseButton; +Shift : TShiftState; X, Y: Integer); +var + ParentCI, NewCI : TComponentInterface; + NewLeft, NewTop, NewWidth, NewHeight : Integer; +// CInterface : TComponentInterface; + CaptureGrabber:TGrabber; +Begin + CaptureGrabber:=GetCaptureGrabber; + if CaptureGrabber<>nil then begin + CaptureGrabber.CaptureMouseUp(TControl(Sender),Button,Shift,X,Y); + exit; + end; + MouseUpPos.X := X; + MouseUpPos.Y := Y; + + + if FMainIDE.SelectedComponent = nil then + Begin //mouse pointer button pressed. + SelectOnlyThisComponent(TComponent(Sender)); + end + else + Begin //add a new control + ParentCI:=TComponentInterface(FFormEditor.FindComponent(TComponent(Sender))); + if (TComponent(Sender) is TWinControl) + and (not (csAcceptsControls in TWinControl(Sender).ControlStyle)) then + begin + ParentCI:=TComponentInterface( + FFormEditor.FindComponent(TWinControl(Sender).Parent)); + end; + if Assigned(ParentCI) then begin + NewLeft:=Min(MouseDownPos.X,MouseUpPos.X); + NewWidth:=Abs(MouseUpPos.X-MouseDownPos.X); + NewTop:=Min(MouseDownPos.Y,MouseUpPos.Y); + NewHeight:=Abs(MouseUpPos.Y-MouseDownPos.Y); + if Abs(NewWidth+NewHeight)<7 then begin + // this very small component is probably only a wag, take default size + NewWidth:=0; + NewHeight:=0; + end; + NewCI := TComponentInterface(FFormEditor.CreateComponent(ParentCI,FMainIDE.SelectedComponent.ComponentClass + ,NewLeft,NewTop,NewWidth,NewHeight)); + NewCI.SetPropByName('Visible',True); //Control).Visible := True; + + ObjectInspector1.FillComponentComboBox; + AddControlCode(NewCI.Control); + Writeln('2222'); + if NewCI.Control is TControl then begin + // set the OnMouseDown and OnMouseUp event so we know when the control + // is selected or a new control is dropped + FMainIDE.SetDesigning(NewCI.Control); +// NewCI.SetPropByName('OnMouseUp',@MouseUpOnControl); +// NewCI.SetPropByName('OnMouseDown',@MouseDownOnControl); +// NewCI.SetPropByName('OnMouseMove',@MouseMoveOnControl); + SelectOnlyThisComponent(TComponent(NewCI.Control)); + end; + Writeln('Calling ControlClick with Nil from MouseUponForm'); + FMainIDE.ControlClick(FMainIDE.Notebook1); //this resets it to the mouse. + end; + end; + + MouseDownControl:=nil; + Writeln('Exiting MouseUPOnForm'); +end; + +procedure TDesigner.MouseDownOnControl(Sender : TControl; Message : TLMessage); +Begin + if GetCaptureGrabber<>nil then exit; + + MouseDownPos.X := TLMMOuse(Message).pos.X; + MouseDownPos.Y := TLMMOuse(Message).pos.Y; + if not (Sender is TCustomForm) then begin + inc(MouseDownPos.X,TControl(Sender).Left); + inc(MouseDownPos.Y,TControl(Sender).Top); + end; + MouseDownControl:=Sender; + LastMouseMovePos:=MouseDownPos; + Writeln(TComponent(Sender).Name+'.OnMouseDown at '+inttostr(MouseDownPos.x) + +','+inttostr(MouseDownPos.Y)); + + if FMainIDE.SelectedComponent = nil then + Begin //mouse pointer button pressed. + if not (Sender is TCustomForm) then begin + SelectOnlyThisComponent(TComponent(Sender)); + end; + end; +End; + +procedure TDesigner.MouseUpOnControl(Sender : TControl; Message:TLMessage); +const + mk_lbutton = 1; + mk_rbutton = 2; + mk_shift = 4; + mk_control = 8; + mk_mbutton = $10; +var + ParentCI, NewCI : TComponentInterface; + NewLeft, NewTop, NewWidth, NewHeight : Integer; +// CInterface : TComponentInterface; + CaptureGrabber:TGrabber; + Button : TMouseButton; + Shift : TShiftState; +Begin + Writeln('In UpOnControl'); + if (TLMMouse(Message).keys and MK_LButton) = MK_LButton then + Button := mbLEft + else + if (TLMMouse(Message).keys and MK_LButton) = MK_RButton then + Button := mbRight; + + Shift := []; + if (TLMMouse(Message).keys and MK_Shift) = MK_Shift then + shift := [ssShift]; + + if (TLMMouse(Message).keys and MK_Control) = MK_Control then + shift := shift +[ssCTRL]; + + + CaptureGrabber:=GetCaptureGrabber; + if CaptureGrabber<>nil then begin + CaptureGrabber.CaptureMouseUp(TControl(Sender),Button,Shift,TLMMouse(Message).pos.X,TLMMouse(Message).pos.Y); + exit; + end; + + MouseUpPos.X := TLMMouse(Message).pos.X; + MouseUpPos.Y := TLMMouse(Message).pos.Y; + if not (Sender is TCustomForm) then begin + inc(MouseUpPos.X,TControl(Sender).Left); + inc(MouseUpPos.Y,TControl(Sender).Top); + end; + Writeln(TComponent(Sender).Name+'.OnMouseUp at '+inttostr(TLMMouse(Message).pos.x)+','+inttostr(TLMMouse(Message).pos.y)); + + if FMainIDE.SelectedComponent = nil then + Begin //mouse pointer button pressed. + if Sender is TCustomForm then + SelectOnlyThisComponent(TComponent(Sender)); + end + else + Begin //add a new control + ParentCI:=TComponentInterface(FFormEditor.FindComponent(TComponent(Sender))); + if (TComponent(Sender) is TWinControl) + and (not (csAcceptsControls in TWinControl(Sender).ControlStyle)) then + begin + ParentCI:=TComponentInterface( + FFormEditor.FindComponent(TWinControl(Sender).Parent)); + end; + if Assigned(ParentCI) then begin + NewLeft:=Min(MouseDownPos.X,MouseUpPos.X); + NewWidth:=Abs(MouseUpPos.X-MouseDownPos.X); + NewTop:=Min(MouseDownPos.Y,MouseUpPos.Y); + NewHeight:=Abs(MouseUpPos.Y-MouseDownPos.Y); + if Abs(NewWidth+NewHeight)<7 then begin + // this very small component is probably only a wag, take default size + NewWidth:=0; + NewHeight:=0; + end; + NewCI := TComponentInterface(FFormEditor.CreateComponent(ParentCI,FMainIDE.SelectedComponent.ComponentClass + ,NewLeft,NewTop,NewWidth,NewHeight)); + NewCI.SetPropByName('Visible',True); //Control).Visible := True; + + ObjectInspector1.FillComponentComboBox; + AddControlCode(NewCI.Control); + + if NewCI.Control is TControl then begin + // set the OnMouseDown and OnMouseUp event so we know when the control + // is selected or a new control is dropped +//why cant I do this here??? NewCI.Control.SetDesigning(True); +// NewCI.SetPropByName('OnMouseUp',@MouseUpOnControl); +// NewCI.SetPropByName('OnMouseDown',@MouseDownOnControl); +// NewCI.SetPropByName('OnMouseMove',@MouseMoveOnControl); + SelectOnlyThisComponent(TComponent(NewCI.Control)); + end; + Writeln('Calling ControlClick with ni from MouseUpOnControl'); + FMainIDE.ControlClick(FMainIDE.Notebook1); //this resets it to the mouse. + end; + end; + + MouseDownControl:=nil; +end; + + + +Procedure TDesigner.MouseMoveOnControl(Sender : TControl; var Message : TLMessage); +const + mk_lbutton = 1; + mk_rbutton = 2; + mk_shift = 4; + mk_control = 8; + mk_mbutton = $10; +var + CaptureGrabber : TGrabber; + Button : TMouseButton; + Shift : TShiftState; + X,Y : Integer; +Begin + X :=TLMMouse(Message).Pos.x; + Y := TLMMouse(Message).Pos.Y; + if (TLMMouse(Message).keys and MK_LButton) = MK_LButton then + Button := mbLEft + else + if (TLMMouse(Message).keys and MK_LButton) = MK_RButton then + Button := mbRight; + Shift := []; + if (TLMMouse(Message).keys and MK_Shift) = MK_Shift then + shift := [ssShift]; + + if (TLMMouse(Message).keys and MK_Control) = MK_Control then + shift := Shift + [ssCTRL]; + + CaptureGrabber:=GetCaptureGrabber; + if CaptureGrabber<>nil then begin + CaptureGrabber.CaptureMouseMove(TControl(Sender),Shift,X,Y); + end else begin + if Assigned(MouseDownControl) then begin + if FMainIDE.SelectedComponent = nil then begin + // mouse pointer button pressed + if not (Sender is TCustomForm) then begin + // move selection + ControlSelection.MoveSelection( + X-LastMouseMovePos.X, Y-LastMouseMovePos.Y); + LastMouseMovePos:=Point(X,Y); + end; + end; + end; + end; +end; + function TDesigner.IsDesignMsg(Sender: TControl; var Message: TLMessage): Boolean; Begin result := false; Writeln('In ISDESIGNMSG'); if ((Message.msg >= LM_MOUSEFIRST) and (Message.msg <= LM_MOUSELAST)) then Result := true; + +if (Message.msg=LM_LBUTTONDOWN) then + begin //select the control + ControlSelection.Clear; + ControlSelection.Add(TControl(Sender)); + end +else +if Message.msg = LM_MOUSEMOVE then + MouseMoveonCOntrol(Sender, Message); + + if Result then Writeln('It IS a design message') else -Writeln('It IS NOT a design message') +Writeln('It IS NOT a design message'); + end; procedure TDesigner.LoadFile(FileName: string); diff --git a/ide/customformeditor.pp b/ide/customformeditor.pp index e9fb5f29cb..bdbff4cc0e 100644 --- a/ide/customformeditor.pp +++ b/ide/customformeditor.pp @@ -133,8 +133,13 @@ end; Function TComponentInterface.FSetProp(PRI : PPropInfo; const Value) : Boolean; Begin +writeln('Index = '+inttostr(PRI^.index)); case PRI^.PropType^.Kind of - tkBool: SetOrdProp(FControl,PRI,longint(Value)); + tkBool: Begin + Writeln('Boolean....'); + SetOrdProp(FControl,PRI,longint(Value)); + Result := True; + end; tkSString, tkLString, tkAString, @@ -397,6 +402,12 @@ Begin Begin Result :=FSetProp(PRI,Value); end; + +if Result = true then +Writeln('SETPROPBYNAME result = true') +else +Writeln('SETPROPBYNAME result = false'); + end; Function TComponentInterface.GetControlCount: Integer; diff --git a/ide/main.pp b/ide/main.pp index 39a036f6e4..830e16ea86 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -32,8 +32,8 @@ uses Classes, LclLinux, compiler, stdctrls, forms, buttons, menus, comctrls, Spin, project,sysutils, global, compileroptions, Controls, graphics, extctrls, Dialogs, dlgMEssage, - Designer, process, idecomp, Find_dlg, FormEditor, AbstractFormEditor, - CustomFormEditor, ObjectInspector, ControlSelection, PropEdits, UnitEditor,CompReg; + process, idecomp, Find_dlg, FormEditor, AbstractFormEditor, + CustomFormEditor,ObjectInspector, ControlSelection, PropEdits, UnitEditor,CompReg; const STANDARDBTNCOUNT = 50; @@ -153,19 +153,20 @@ type Procedure FileOpenedEvent(Sender : TObject; Filename : String); Procedure FileSavedEvent(Sender : TObject; Filename : String); - procedure MouseDownOnControl(Sender : TObject; Button: TMouseButton; Shift : TShiftState; X, Y: Integer); - procedure MouseMoveOnControl(Sender : TObject; Shift : TShiftState; X, Y: Integer); - procedure MouseUpOnControl(Sender : TObject; Button: TMouseButton; Shift : TShiftState; X, Y: Integer); - procedure ControlClick(Sender : TObject); +// procedure MouseDownOnControl(Sender : TObject; Button: TMouseButton; Shift : TShiftState; X, Y: Integer); +// procedure MouseMoveOnControl(Sender : TObject; Shift : TShiftState; X, Y: Integer); +// procedure MouseUpOnControl(Sender : TObject; Button: TMouseButton; Shift : TShiftState; X, Y: Integer); + Procedure COntrolClick(Sender : TObject); procedure MessageViewDblClick(Sender : TObject); - function FindDesigner(ChildComponent:TComponent):TDesigner; - procedure SelectOnlyThisComponent(AComponent:TComponent); +// function FindDesigner(ChildComponent:TComponent):TDesigner; +// procedure SelectOnlyThisComponent(AComponent:TComponent); procedure OIOnAddAvailableComponent(AComponent:TComponent; var Allowed:boolean); procedure OIOnSelectComponent(AComponent:TComponent); private FCodeLastActivated : Boolean; //used for toggling between code and forms FControlLastActivated : TObject; + FSelectedComponent : TRegisteredComponent; Function CreateSeperator : TMenuItem; Function ReturnActiveUnitList : TUnitInfo; @@ -179,18 +180,18 @@ type // Procedure Paint; override; Function ReturnFormName(Source : TStringList) : String; - SelectedComponent : TRegisteredComponent; public constructor Create(AOwner: TComponent); override; procedure LoadMainMenu; Procedure FormKill(Sender : TObject); Procedure SetFlags(SLIst : TUnitInfo); Procedure SetName_Form(SList : TUnitInfo); - + Procedure SetDesigning(Control : TComponent); procedure FormPaint(Sender : TObject); //these numbers are used to determine where the mouse was when the button was pressed MouseDownPos, MouseUpPos, LastMouseMovePos : TPoint; MouseDownControl: TObject; + property SelectedComponent : TRegisteredComponent read FSelectedComponent write FSelectedComponent; end; @@ -216,7 +217,7 @@ var implementation uses - TestForm, ViewUnit_dlg,ViewForm_dlg, Math,lresources; + TestForm, ViewUnit_dlg,ViewForm_dlg, Math,lresources, Designer; { TMainIDE } @@ -710,8 +711,12 @@ begin end; procedure TMainIDE.OIOnSelectComponent(AComponent:TComponent); +var +Form : TCustomForm; begin - SelectOnlyThisComponent(AComponent); +Form := GetParentForm(TControl(AComponent)); +//not implemented yet +TDesigner(Form.Designer).SelectOnlyThisComponent(AComponent); end; Procedure TMainIDE.ToolButtonCLick(Sender : TObject); @@ -1135,6 +1140,12 @@ FControlLastActivated := Sender; end; +Procedure TMainIDE.SetDesigning(Control : TComponent); +Begin +Control.SetDesigning(True); +end; + + { ------------------------------------------------------------------------ @@ -1152,8 +1163,13 @@ var Speedbutton : TSpeedbutton; Temp : TControl; begin + Writeln('In ControlClick with nil?'); + if Sender=nil then Writeln('yep, Sender is nil'); + if Sender is TSpeedButton then Begin + Writeln('sender is a speedbutton'); + Writeln('The name is '+TSpeedbutton(sender).name); SpeedButton := TSPeedButton(Sender); Writeln('Speedbutton s Name is '+SpeedButton.name); //find the IDECOmponent that has this speedbutton @@ -1176,14 +1192,14 @@ begin else Writeln('*****************ERROR - Control '+'GlobalMouseSpeedButton'+inttostr(Notebook1.Pageindex)+' not found'); end; - if IDECOmp <> nil then - Begin + if IDECOmp <> nil then + Begin //draw this button down SpeedButton.Down := True; SelectedComponent := IDEComp.RegisteredComponent; - end - else - begin + end + else + begin SelectedComponent := nil; Temp := nil; for i := 0 to Notebook1.Page[Notebook1.Pageindex].ControlCount-1 do @@ -1198,11 +1214,11 @@ begin TSpeedButton(Temp).down := True else Writeln('*****************ERROR - Control '+'GlobalMouseSpeedButton'+inttostr(Notebook1.Pageindex)+' not found'); - end; - + end; end else Begin + Writeln('must be nil'); //draw old speedbutton up if SelectedComponent <> nil then TIDeComponent(IdeCompList.FindCompByRegComponent(SelectedComponent)).SpeedButton.Down := False; @@ -1222,11 +1238,12 @@ begin Writeln('*****************ERROR - Control '+'GlobalMouseSpeedButton'+inttostr(Notebook1.Pageindex)+' not found'); end; +Writeln('Exiting ControlClick'); end; -function TMainIDE.FindDesigner(ChildComponent:TComponent):TDesigner; +{function TMainIDE.FindDesigner(ChildComponent:TComponent):TDesigner; begin if ChildComponent is TForm then Result:=TDesigner(TForm(ChildComponent).Designer) @@ -1236,8 +1253,8 @@ begin else Result:=nil; end; - -procedure TMainIDE.SelectOnlyThisComponent(AComponent:TComponent); + } +{procedure TMainIDE.SelectOnlyThisComponent(AComponent:TComponent); var CurDesigner:TDesigner; begin @@ -1251,7 +1268,7 @@ begin // this will automatically inform the object inspector FormEditor1.AddSelected(AComponent); end; - + } {------------------------------------------------------------------------------} {------------------------------------------------------------------------------} @@ -1263,7 +1280,7 @@ end; {------------------------------------------------------------------------------} {------------------------------------------------------------------------------} {------------------------------------------------------------------------------} -procedure TMainIDE.MouseDownOnControl(Sender : TObject; Button: TMouseButton; +{procedure TMainIDE.MouseDownOnControl(Sender : TObject; Button: TMouseButton; Shift : TShiftState; X, Y: Integer); Begin if GetCaptureGrabber<>nil then exit; @@ -1366,7 +1383,6 @@ Begin end; NewCI := TComponentInterface(FormEditor1.CreateComponent(ParentCI,SelectedComponent.ComponentClass ,NewLeft,NewTop,NewWidth,NewHeight)); - NewCI.SetPropByName('Designing',True); NewCI.SetPropByName('Visible',True); //Control).Visible := True; ObjectInspector1.FillComponentComboBox; @@ -1376,9 +1392,10 @@ Begin // set the OnMouseDown and OnMouseUp event so we know when the control // is selected or a new control is dropped writeln('NewComponent is TControl'); - NewCI.SetPropByName('OnMouseUp',@MouseUpOnControl); - NewCI.SetPropByName('OnMouseDown',@MouseDownOnControl); - NewCI.SetPropByName('OnMouseMove',@MouseMoveOnControl); + NewCI.Control.SetDesigning(True); +// NewCI.SetPropByName('OnMouseUp',@MouseUpOnControl); +// NewCI.SetPropByName('OnMouseDown',@MouseDownOnControl); +// NewCI.SetPropByName('OnMouseMove',@MouseMoveOnControl); SelectOnlyThisComponent(TComponent(NewCI.Control)); end; end; @@ -1387,7 +1404,7 @@ writeln('NewComponent is TControl'); MouseDownControl:=nil; ControlClick(Notebook1); //this resets it to the mouse. end; - + } {------------------------------------------------------------------------------} procedure TMainIDE.mnuNewFormClicked(Sender : TObject); var @@ -1410,19 +1427,25 @@ begin ObjectInspector1.Left+ObjectInspector1.Width+5,ObjectInspector1.Top, 400,300)); - CInterface.SetPropByName('Designing',True); TempForm:=TForm(CInterface.Control); + //TempForm.SetDesigning(true); + TempForm.Designer := TDesigner.Create(TCustomForm(CInterface.Control)); + + TDesigner(TempForm.Designer).MainIDE := Self; + TDesigner(TempForm.Designer).FormEditor := FormEditor1; TDesigner(tempForm.Designer).SourceEditor := SourceNotebook.CreateUnitFromForm(TempForm); - TempForm.OnMouseDown := @MouseDownOnControl; - TempForm.OnMouseUp := @MouseUpOnControl; - TempForm.OnMouseMove := @MouseMoveOnControl; + TempForm.OnMouseDown := @TDesigner(TempForm.Designer).MouseDownOnForm; + TempForm.OnMouseUp := @TDesigner(TempForm.Designer).MouseUpOnForm; + TempForm.OnMouseMove := @TDesigner(TempForm.Designer).MouseMoveOnForm; TempForm.OnActivate := @CodeOrFormActivated; + Writeln('display form'); TempForm.Show; + Writeln('display form'); PropertyEditorHook1.LookupRoot := TForm(CInterface.Control); FormEditor1.ClearSelected; @@ -1869,8 +1892,9 @@ end. { ============================================================================= $Log$ - Revision 1.34 2001/01/05 18:56:23 lazarus - Minor changes + Revision 1.35 2001/01/06 06:28:47 lazarus + Made Designer control the control movement and such. I am now using ISDesignMsg to move the controls. + Shane Revision 1.32 2001/01/04 20:33:53 lazarus Moved lresources.