IDE-Inspector: Selector fow children (controls)

git-svn-id: trunk@27842 -
This commit is contained in:
martin 2010-10-24 22:41:47 +00:00
parent f6519bc9eb
commit 5989dd4ec9
2 changed files with 60 additions and 4 deletions

View File

@ -29,7 +29,7 @@ object IdeInspectForm: TIdeInspectForm
Style = tbsDropDown Style = tbsDropDown
end end
object btnSubComponent: TToolButton object btnSubComponent: TToolButton
Left = 67 Left = 75
Top = 0 Top = 0
AutoSize = True AutoSize = True
DropdownMenu = popSubComponent DropdownMenu = popSubComponent
@ -49,6 +49,20 @@ object IdeInspectForm: TIdeInspectForm
ImageIndex = 0 ImageIndex = 0
OnClick = btnRemoveSelectedClick OnClick = btnRemoveSelectedClick
end end
object ToolButton2: TToolButton
Left = 67
Top = 0
Width = 8
Caption = 'ToolButton2'
Style = tbsSeparator
end
object btnControls: TToolButton
Left = 110
Top = 0
DropdownMenu = popControls
OnClick = btnControlsClick
Style = tbsDropDown
end
end end
object TreeView1: TTreeView object TreeView1: TTreeView
Left = 0 Left = 0
@ -120,4 +134,9 @@ object IdeInspectForm: TIdeInspectForm
FF00FFFFFF00FFFFFF00FFFFFF00 FF00FFFFFF00FFFFFF00FFFFFF00
} }
end end
object popControls: TPopupMenu
OnPopup = popControlsPopup
left = 326
top = 49
end
end end

View File

@ -16,17 +16,22 @@ type
ImageList1: TImageList; ImageList1: TImageList;
popComponent: TPopupMenu; popComponent: TPopupMenu;
popSubComponent: TPopupMenu; popSubComponent: TPopupMenu;
popControls: TPopupMenu;
Splitter1: TSplitter; Splitter1: TSplitter;
ToolBar1: TToolBar; ToolBar1: TToolBar;
btnComponent: TToolButton; btnComponent: TToolButton;
btnSubComponent: TToolButton; btnSubComponent: TToolButton;
ToolButton1: TToolButton; ToolButton1: TToolButton;
btnRemoveSelected: TToolButton; btnRemoveSelected: TToolButton;
ToolButton2: TToolButton;
btnControls: TToolButton;
TreeView1: TTreeView; TreeView1: TTreeView;
procedure btnControlsClick(Sender: TObject);
procedure btnSubComponentClick(Sender: TObject); procedure btnSubComponentClick(Sender: TObject);
procedure MenuItem1Click(Sender: TObject); procedure MenuItem1Click(Sender: TObject);
procedure btnComponentClick(Sender: TObject); procedure btnComponentClick(Sender: TObject);
procedure popComponentPopup(Sender: TObject); procedure popComponentPopup(Sender: TObject);
procedure popControlsPopup(Sender: TObject);
procedure popSubComponentPopup(Sender: TObject); procedure popSubComponentPopup(Sender: TObject);
procedure btnRemoveSelectedClick(Sender: TObject); procedure btnRemoveSelectedClick(Sender: TObject);
procedure TreeView1Change(Sender: TObject; Node: TTreeNode); procedure TreeView1Change(Sender: TObject; Node: TTreeNode);
@ -53,8 +58,9 @@ resourcestring
ideinspApplcicationComponents = 'Applcication.Components'; ideinspApplcicationComponents = 'Applcication.Components';
ideinspScreenForms = 'Screen.Forms'; ideinspScreenForms = 'Screen.Forms';
ideinspQuickLinks = 'Quick links'; ideinspQuickLinks = 'Quick links';
ideinspChildren = 'Children'; ideinspComponentsOwned = 'Components (Owned)';
ideinspRemoveSelectedItemSFromTree = 'Remove selected item(s) from tree'; ideinspRemoveSelectedItemSFromTree = 'Remove selected item(s) from tree';
ideinspControlsChildren = 'Controls (Children)';
procedure Register; procedure Register;
@ -85,6 +91,11 @@ begin
btnSubComponent.CheckMenuDropdown; btnSubComponent.CheckMenuDropdown;
end; end;
procedure TIdeInspectForm.btnControlsClick(Sender: TObject);
begin
btnControls.CheckMenuDropdown;
end;
procedure TIdeInspectForm.btnComponentClick(Sender: TObject); procedure TIdeInspectForm.btnComponentClick(Sender: TObject);
begin begin
btnComponent.CheckMenuDropdown; btnComponent.CheckMenuDropdown;
@ -126,6 +137,26 @@ begin
end; end;
end; end;
procedure TIdeInspectForm.popControlsPopup(Sender: TObject);
var
i: Integer;
m: TExtMenuItem;
begin
popControls.Items.Clear;
if (FSelected = nil) or not(FSelected is TWinControl) then
exit;
for i := 0 to TWinControl(FSelected).ControlCount - 1 do begin
m := TExtMenuItem.Create(Self);
m.Caption := TWinControl(FSelected).Controls[i].Name +
' ['+TWinControl(FSelected).Controls[i].ClassName+']'+
' ('+IntToStr(TWinControl(FSelected).Controls[i].ComponentCount)+')';
m.TheObject := TWinControl(FSelected).Controls[i];
m.OnClick := @MenuItem1Click;
popControls.Items.Add(m);
end;
end;
procedure TIdeInspectForm.popSubComponentPopup(Sender: TObject); procedure TIdeInspectForm.popSubComponentPopup(Sender: TObject);
var var
i: Integer; i: Integer;
@ -173,6 +204,8 @@ begin
FSelected := AComp; FSelected := AComp;
FPropertiesGrid.TIObject := FSelected; FPropertiesGrid.TIObject := FSelected;
btnSubComponent.Enabled := (FSelected <> nil) and (FSelected.ComponentCount > 0); btnSubComponent.Enabled := (FSelected <> nil) and (FSelected.ComponentCount > 0);
btnControls.Enabled := (FSelected <> nil) and
(FSelected is TWinControl) and (TWinControl(FSelected).ControlCount > 0);
UpdateTree; UpdateTree;
end; end;
@ -228,7 +261,10 @@ begin
end; end;
ANode.Delete; ANode.Delete;
UpdateTree; UpdateTree;
end; end
else
if AComponent = FSelected then
SetSelected(nil);
end; end;
inherited Notification(AComponent, Operation); inherited Notification(AComponent, Operation);
end; end;
@ -245,7 +281,8 @@ begin
BorderSpacing.Around := 6; BorderSpacing.Around := 6;
end; end;
btnComponent.Caption := ideinspQuickLinks; btnComponent.Caption := ideinspQuickLinks;
btnSubComponent.Caption := ideinspChildren; btnSubComponent.Caption := ideinspComponentsOwned;
btnControls.Caption := ideinspControlsChildren;
btnRemoveSelected.Hint := ideinspRemoveSelectedItemSFromTree; btnRemoveSelected.Hint := ideinspRemoveSelectedItemSFromTree;
SetSelected(Application); SetSelected(Application);