diff --git a/ide/componentlist.lfm b/ide/componentlist.lfm index c64220b264..72b336c197 100644 --- a/ide/componentlist.lfm +++ b/ide/componentlist.lfm @@ -54,6 +54,7 @@ object ComponentListForm: TComponentListForm TabOrder = 0 OnDblClick = ComponentsDblClick OnKeyPress = TreeKeyPress + OnMouseDown = TreeMouseDown OnSelectionChanged = ListTreeSelectionChanged Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRowSelect, tvoToolTips] end @@ -90,6 +91,7 @@ object ComponentListForm: TComponentListForm TabOrder = 0 OnDblClick = ComponentsDblClick OnKeyPress = TreeKeyPress + OnMouseDown = TreeMouseDown OnSelectionChanged = ListTreeSelectionChanged Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoRowSelect, tvoShowButtons, tvoShowRoot, tvoToolTips] end @@ -126,6 +128,7 @@ object ComponentListForm: TComponentListForm TabOrder = 0 OnDblClick = ComponentsDblClick OnKeyPress = TreeKeyPress + OnMouseDown = TreeMouseDown OnSelectionChanged = ListTreeSelectionChanged Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoRowSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips] end diff --git a/ide/componentlist.pas b/ide/componentlist.pas index dc4c39fd1c..6ec4b93424 100644 --- a/ide/componentlist.pas +++ b/ide/componentlist.pas @@ -89,6 +89,8 @@ type SelectionToolButton: TSpeedButton; procedure chbKeepOpenChange(Sender: TObject); procedure FormShow(Sender: TObject); + procedure TreeMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); procedure ListTreeSelectionChanged(Sender: TObject); procedure miCollapseAllClick(Sender: TObject); procedure miCollapseClick(Sender: TObject); @@ -111,6 +113,7 @@ type private FOnOpenPackage: TNotifyEvent; FOnOpenUnit: TNotifyEvent; + FOnClassSelected: TNotifyEvent; PrevChangeStamp: Integer; FInitialized: Boolean; FIgnoreSelection: Boolean; @@ -138,6 +141,7 @@ type function GetSelectedPkgComp: TPkgComponent; property OnOpenPackage: TNotifyEvent read FOnOpenPackage write FOnOpenPackage; property OnOpenUnit: TNotifyEvent read FOnOpenUnit write FOnOpenUnit; + property OnClassSelected: TNotifyEvent read FOnClassSelected write FOnClassSelected; end; var @@ -611,6 +615,16 @@ begin end end; +procedure TComponentListForm.TreeMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); +begin + // ignore right click to bring up context menu + if (Button <> mbLeft) or IsDocked or chbKeepOpen.Checked then Exit; + // show form editor + if assigned(OnClassSelected) then + OnClassSelected(self); +end; + procedure TComponentListForm.TreeKeyPress(Sender: TObject; var Key: char); // This is used for all 3 treeviews begin @@ -748,8 +762,8 @@ begin if (OldFocusedControl<>nil) and OldFocusedControl.CanSetFocus then OldFocusedControl.SetFocus; // AddComponent in docked mode steals focus to designer, get it back - if not IsDocked and not chbKeepOpen.Checked then - Close; + if IsDocked or chbKeepOpen.Checked then Exit; + Close; end; procedure TComponentListForm.miCollapseAllClick(Sender: TObject); @@ -861,6 +875,10 @@ procedure TComponentListForm.SelectionToolButtonClick(Sender: TObject); begin SelectionToolButton.Down := True; IDEComponentPalette.SetSelectedComp(nil, False); + if IsDocked or chbKeepOpen.Checked then Exit; + // show form editor + if assigned(OnClassSelected) then + OnClassSelected(self); end; end. diff --git a/ide/main.pp b/ide/main.pp index d3e12b8e71..9dde094f09 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -6166,6 +6166,7 @@ begin State=iwgfDisabled,OwningComponent); ComponentListForm.OnOpenPackage:=@PkgBoss.IDEComponentPaletteOpenPackage; ComponentListForm.OnOpenUnit:=@PkgBoss.IDEComponentPaletteOpenUnit; + ComponentListForm.OnClassSelected:=@ComponentPaletteClassSelected; end else if State=iwgfDisabled then ComponentListForm.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.DoShowComponentList'){$ENDIF}; if State>=iwgfShow then