* small improvements on componentlist form by Marius

git-svn-id: trunk@13135 -
This commit is contained in:
marc 2007-12-03 23:57:17 +00:00
parent aab042f968
commit f0c0d91fca
3 changed files with 133 additions and 130 deletions

View File

@ -1,36 +1,37 @@
object ComponentListForm: TComponentListForm object ComponentListForm: TComponentListForm
Left = 288 Left = 37
Height = 555 Height = 555
Top = 221 Top = 172
Width = 232 Width = 231
HorzScrollBar.Page = 231 HorzScrollBar.Page = 230
VertScrollBar.Page = 554 VertScrollBar.Page = 554
ActiveControl = CloseButton ActiveControl = PatternEdit
Caption = 'Components' Caption = 'Components'
ClientHeight = 555 ClientHeight = 555
ClientWidth = 232 ClientWidth = 231
KeyPreview = True KeyPreview = True
OnKeyDown = FormKeyDown OnKeyDown = FormKeyDown
OnShow = FormShow
object Panel1: TPanel object Panel1: TPanel
Height = 555 Height = 555
Width = 232 Width = 231
Align = alClient Align = alClient
BevelOuter = bvLowered BevelOuter = bvLowered
Caption = 'Panel1' Caption = 'Panel1'
ClientHeight = 555 ClientHeight = 555
ClientWidth = 232 ClientWidth = 231
TabOrder = 0 TabOrder = 0
object Panel2: TPanel object Panel2: TPanel
Left = 1 Left = 1
Height = 36 Height = 36
Top = 518 Top = 518
Width = 230 Width = 229
Align = alBottom Align = alBottom
ClientHeight = 36 ClientHeight = 36
ClientWidth = 230 ClientWidth = 229
TabOrder = 0 TabOrder = 0
object CloseButton: TButton object CloseButton: TButton
Left = 145 Left = 144
Height = 26 Height = 26
Top = 4 Top = 4
Width = 73 Width = 73
@ -45,11 +46,11 @@ object ComponentListForm: TComponentListForm
Left = 1 Left = 1
Height = 38 Height = 38
Top = 1 Top = 1
Width = 230 Width = 229
Align = alTop Align = alTop
BorderWidth = 8 BorderWidth = 8
ClientHeight = 38 ClientHeight = 38
ClientWidth = 230 ClientWidth = 229
TabOrder = 1 TabOrder = 1
object LabelSearch: TLabel object LabelSearch: TLabel
Left = 5 Left = 5
@ -63,7 +64,7 @@ object ComponentListForm: TComponentListForm
Left = 71 Left = 71
Height = 23 Height = 23
Top = 8 Top = 8
Width = 118 Width = 117
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
OnChange = UpdateComponentSelection OnChange = UpdateComponentSelection
TabOrder = 0 TabOrder = 0
@ -73,38 +74,38 @@ object ComponentListForm: TComponentListForm
Left = 1 Left = 1
Height = 479 Height = 479
Top = 39 Top = 39
Width = 230 Width = 229
Align = alClient Align = alClient
ClientHeight = 479 ClientHeight = 479
ClientWidth = 230 ClientWidth = 229
TabOrder = 2 TabOrder = 2
object PageControl: TPageControl object PageControl: TPageControl
Left = 1 Left = 1
Height = 477 Height = 477
Top = 1 Top = 1
Width = 228 Width = 227
ActivePage = TabSheetInheritance ActivePage = TabSheetListBox
Align = alClient Align = alClient
TabIndex = 2 TabIndex = 0
TabOrder = 0 TabOrder = 0
object TabSheetListBox: TTabSheet object TabSheetListBox: TTabSheet
Caption = 'List' Caption = 'List'
ClientHeight = 477 ClientHeight = 447
ClientWidth = 228 ClientWidth = 223
object Panel7: TPanel object Panel7: TPanel
Height = 477 Height = 447
Width = 228 Width = 223
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
BorderWidth = 5 BorderWidth = 5
ClientHeight = 477 ClientHeight = 447
ClientWidth = 228 ClientWidth = 223
TabOrder = 0 TabOrder = 0
object ListboxComponents: TListBox object ListboxComponents: TListBox
Left = 5 Left = 5
Height = 467 Height = 437
Top = 5 Top = 5
Width = 218 Width = 213
Align = alClient Align = alClient
OnDblClick = ListboxComponentsDblClick OnDblClick = ListboxComponentsDblClick
Sorted = True Sorted = True
@ -115,57 +116,56 @@ object ComponentListForm: TComponentListForm
end end
object TabSheetPaletteTree: TTabSheet object TabSheetPaletteTree: TTabSheet
Caption = 'Palette' Caption = 'Palette'
ClientHeight = 447 ClientHeight = 477
ClientWidth = 224 ClientWidth = 227
object Panel5: TPanel object Panel5: TPanel
Height = 447 Height = 477
Width = 224 Width = 227
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
BorderWidth = 5 BorderWidth = 5
ClientHeight = 447 ClientHeight = 477
ClientWidth = 224 ClientWidth = 227
TabOrder = 0 TabOrder = 0
object TreePallette: TTreeView object TreePallette: TTreeView
Left = 5 Left = 5
Height = 437 Height = 467
Top = 5 Top = 5
Width = 214 Width = 217
Align = alClient Align = alClient
DefaultItemHeight = 14 DefaultItemHeight = 14
ReadOnly = True ReadOnly = True
ShowLines = False
TabOrder = 0 TabOrder = 0
OnCollapsing = TreePalletteCollapsing
OnDblClick = TreePalletteDblClick OnDblClick = TreePalletteDblClick
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips] Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowRoot, tvoToolTips, tvoNoDoubleClickExpand]
end end
end end
end end
object TabSheetInheritance: TTabSheet object TabSheetInheritance: TTabSheet
Caption = 'Inheritance' Caption = 'Inheritance'
ClientHeight = 447 ClientHeight = 447
ClientWidth = 224 ClientWidth = 223
object Panel6: TPanel object Panel6: TPanel
Height = 447 Height = 447
Width = 224 Width = 223
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
BorderWidth = 5 BorderWidth = 5
ClientHeight = 447 ClientHeight = 447
ClientWidth = 224 ClientWidth = 223
TabOrder = 0 TabOrder = 0
object TreeInheritance: TTreeView object TreeInheritance: TTreeView
Left = 5 Left = 5
Height = 437 Height = 437
Top = 5 Top = 5
Width = 214 Width = 213
Align = alClient Align = alClient
DefaultItemHeight = 14 DefaultItemHeight = 14
ReadOnly = True ReadOnly = True
TabOrder = 0 TabOrder = 0
OnCollapsing = TreePalletteCollapsing
OnDblClick = TreeInheritanceDblClick OnDblClick = TreeInheritanceDblClick
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips] Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoNoDoubleClickExpand]
end end
end end
end end

View File

@ -1,54 +1,54 @@
{ This is an automatically generated lazarus resource file } { This is an automatically generated lazarus resource file }
LazarusResources.Add('TComponentListForm','FORMDATA',[ LazarusResources.Add('TComponentListForm','FORMDATA',[
'TPF0'#18'TComponentListForm'#17'ComponentListForm'#4'Left'#3' '#1#6'Height'#3 'TPF0'#18'TComponentListForm'#17'ComponentListForm'#4'Left'#2'%'#6'Height'#3
+'+'#2#3'Top'#3#221#0#5'Width'#3#232#0#18'HorzScrollBar.Page'#3#231#0#18'Vert' +'+'#2#3'Top'#3#172#0#5'Width'#3#231#0#18'HorzScrollBar.Page'#3#230#0#18'Vert'
+'ScrollBar.Page'#3'*'#2#13'ActiveControl'#7#11'CloseButton'#7'Caption'#6#10 +'ScrollBar.Page'#3'*'#2#13'ActiveControl'#7#11'PatternEdit'#7'Caption'#6#10
+'Components'#12'ClientHeight'#3'+'#2#11'ClientWidth'#3#232#0#10'KeyPreview'#9 +'Components'#12'ClientHeight'#3'+'#2#11'ClientWidth'#3#231#0#10'KeyPreview'#9
+#9'OnKeyDown'#7#11'FormKeyDown'#0#6'TPanel'#6'Panel1'#6'Height'#3'+'#2#5'Wid' +#9'OnKeyDown'#7#11'FormKeyDown'#6'OnShow'#7#8'FormShow'#0#6'TPanel'#6'Panel1'
+'th'#3#232#0#5'Align'#7#8'alClient'#10'BevelOuter'#7#9'bvLowered'#7'Caption' +#6'Height'#3'+'#2#5'Width'#3#231#0#5'Align'#7#8'alClient'#10'BevelOuter'#7#9
+#6#6'Panel1'#12'ClientHeight'#3'+'#2#11'ClientWidth'#3#232#0#8'TabOrder'#2#0 +'bvLowered'#7'Caption'#6#6'Panel1'#12'ClientHeight'#3'+'#2#11'ClientWidth'#3
+#0#6'TPanel'#6'Panel2'#4'Left'#2#1#6'Height'#2'$'#3'Top'#3#6#2#5'Width'#3#230 +#231#0#8'TabOrder'#2#0#0#6'TPanel'#6'Panel2'#4'Left'#2#1#6'Height'#2'$'#3'To'
+#0#5'Align'#7#8'alBottom'#12'ClientHeight'#2'$'#11'ClientWidth'#3#230#0#8'Ta' +'p'#3#6#2#5'Width'#3#229#0#5'Align'#7#8'alBottom'#12'ClientHeight'#2'$'#11'C'
+'bOrder'#2#0#0#7'TButton'#11'CloseButton'#4'Left'#3#145#0#6'Height'#2#26#3'T' +'lientWidth'#3#229#0#8'TabOrder'#2#0#0#7'TButton'#11'CloseButton'#4'Left'#3
+'op'#2#4#5'Width'#2'I'#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#7 +#144#0#6'Height'#2#26#3'Top'#2#4#5'Width'#2'I'#7'Anchors'#11#7'akRight'#8'ak'
+'Caption'#6#11'CloseButton'#7'OnClick'#7#16'CloseButtonClick'#8'TabOrder'#2#0 +'Bottom'#0#8'AutoSize'#9#7'Caption'#6#11'CloseButton'#7'OnClick'#7#16'CloseB'
+#0#0#0#6'TPanel'#6'Panel3'#4'Left'#2#1#6'Height'#2'&'#3'Top'#2#1#5'Width'#3 +'uttonClick'#8'TabOrder'#2#0#0#0#0#6'TPanel'#6'Panel3'#4'Left'#2#1#6'Height'
+#230#0#5'Align'#7#5'alTop'#11'BorderWidth'#2#8#12'ClientHeight'#2'&'#11'Clie' +#2'&'#3'Top'#2#1#5'Width'#3#229#0#5'Align'#7#5'alTop'#11'BorderWidth'#2#8#12
+'ntWidth'#3#230#0#8'TabOrder'#2#1#0#6'TLabel'#11'LabelSearch'#4'Left'#2#5#6 +'ClientHeight'#2'&'#11'ClientWidth'#3#229#0#8'TabOrder'#2#1#0#6'TLabel'#11'L'
+'Height'#2#14#3'Top'#2#12#5'Width'#2';'#7'Caption'#6#11'LabelSearch'#11'Pare' +'abelSearch'#4'Left'#2#5#6'Height'#2#14#3'Top'#2#12#5'Width'#2';'#7'Caption'
+'ntColor'#8#0#0#5'TEdit'#11'PatternEdit'#4'Left'#2'G'#6'Height'#2#23#3'Top'#2 +#6#11'LabelSearch'#11'ParentColor'#8#0#0#5'TEdit'#11'PatternEdit'#4'Left'#2
+#8#5'Width'#2'v'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'OnChange'#7 +'G'#6'Height'#2#23#3'Top'#2#8#5'Width'#2'u'#7'Anchors'#11#5'akTop'#6'akLeft'
+#24'UpdateComponentSelection'#8'TabOrder'#2#0#0#0#0#6'TPanel'#6'Panel4'#4'Le' +#7'akRight'#0#8'OnChange'#7#24'UpdateComponentSelection'#8'TabOrder'#2#0#0#0
+'ft'#2#1#6'Height'#3#223#1#3'Top'#2''''#5'Width'#3#230#0#5'Align'#7#8'alClie' +#0#6'TPanel'#6'Panel4'#4'Left'#2#1#6'Height'#3#223#1#3'Top'#2''''#5'Width'#3
+'nt'#12'ClientHeight'#3#223#1#11'ClientWidth'#3#230#0#8'TabOrder'#2#2#0#12'T' +#229#0#5'Align'#7#8'alClient'#12'ClientHeight'#3#223#1#11'ClientWidth'#3#229
+'PageControl'#11'PageControl'#4'Left'#2#1#6'Height'#3#221#1#3'Top'#2#1#5'Wid' +#0#8'TabOrder'#2#2#0#12'TPageControl'#11'PageControl'#4'Left'#2#1#6'Height'#3
+'th'#3#228#0#10'ActivePage'#7#19'TabSheetInheritance'#5'Align'#7#8'alClient' +#221#1#3'Top'#2#1#5'Width'#3#227#0#10'ActivePage'#7#15'TabSheetListBox'#5'Al'
+#8'TabIndex'#2#2#8'TabOrder'#2#0#0#9'TTabSheet'#15'TabSheetListBox'#7'Captio' +'ign'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2#0#0#9'TTabSheet'#15'TabShe'
+'n'#6#4'List'#12'ClientHeight'#3#221#1#11'ClientWidth'#3#228#0#0#6'TPanel'#6 +'etListBox'#7'Caption'#6#4'List'#12'ClientHeight'#3#191#1#11'ClientWidth'#3
+'Panel7'#6'Height'#3#221#1#5'Width'#3#228#0#5'Align'#7#8'alClient'#10'BevelO' +#223#0#0#6'TPanel'#6'Panel7'#6'Height'#3#191#1#5'Width'#3#223#0#5'Align'#7#8
+'uter'#7#6'bvNone'#11'BorderWidth'#2#5#12'ClientHeight'#3#221#1#11'ClientWid' +'alClient'#10'BevelOuter'#7#6'bvNone'#11'BorderWidth'#2#5#12'ClientHeight'#3
+'th'#3#228#0#8'TabOrder'#2#0#0#8'TListBox'#17'ListboxComponents'#4'Left'#2#5 +#191#1#11'ClientWidth'#3#223#0#8'TabOrder'#2#0#0#8'TListBox'#17'ListboxCompo'
+#6'Height'#3#211#1#3'Top'#2#5#5'Width'#3#218#0#5'Align'#7#8'alClient'#10'OnD' +'nents'#4'Left'#2#5#6'Height'#3#181#1#3'Top'#2#5#5'Width'#3#213#0#5'Align'#7
+'blClick'#7#25'ListboxComponentsDblClick'#6'Sorted'#9#8'TabOrder'#2#0#8'TopI' +#8'alClient'#10'OnDblClick'#7#25'ListboxComponentsDblClick'#6'Sorted'#9#8'Ta'
+'ndex'#2#255#0#0#0#0#9'TTabSheet'#19'TabSheetPaletteTree'#7'Caption'#6#7'Pal' +'bOrder'#2#0#8'TopIndex'#2#255#0#0#0#0#9'TTabSheet'#19'TabSheetPaletteTree'#7
+'ette'#12'ClientHeight'#3#191#1#11'ClientWidth'#3#224#0#0#6'TPanel'#6'Panel5' +'Caption'#6#7'Palette'#12'ClientHeight'#3#221#1#11'ClientWidth'#3#227#0#0#6
+#6'Height'#3#191#1#5'Width'#3#224#0#5'Align'#7#8'alClient'#10'BevelOuter'#7#6 +'TPanel'#6'Panel5'#6'Height'#3#221#1#5'Width'#3#227#0#5'Align'#7#8'alClient'
+'bvNone'#11'BorderWidth'#2#5#12'ClientHeight'#3#191#1#11'ClientWidth'#3#224#0 +#10'BevelOuter'#7#6'bvNone'#11'BorderWidth'#2#5#12'ClientHeight'#3#221#1#11
+#8'TabOrder'#2#0#0#9'TTreeView'#12'TreePallette'#4'Left'#2#5#6'Height'#3#181 +'ClientWidth'#3#227#0#8'TabOrder'#2#0#0#9'TTreeView'#12'TreePallette'#4'Left'
+#1#3'Top'#2#5#5'Width'#3#214#0#5'Align'#7#8'alClient'#17'DefaultItemHeight'#2 +#2#5#6'Height'#3#211#1#3'Top'#2#5#5'Width'#3#217#0#5'Align'#7#8'alClient'#17
+#14#8'ReadOnly'#9#8'TabOrder'#2#0#12'OnCollapsing'#7#22'TreePalletteCollapsi' +'DefaultItemHeight'#2#14#8'ReadOnly'#9#9'ShowLines'#8#8'TabOrder'#2#0#10'OnD'
+'ng'#10'OnDblClick'#7#20'TreePalletteDblClick'#7'Options'#11#17'tvoAutoItemH' +'blClick'#7#20'TreePalletteDblClick'#7'Options'#11#17'tvoAutoItemHeight'#16
+'eight'#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#14'tv' +'tvoHideSelection'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#14'tvoShowButto'
+'oShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#0#0#9 +'ns'#11'tvoShowRoot'#11'tvoToolTips'#22'tvoNoDoubleClickExpand'#0#0#0#0#0#9
+'TTabSheet'#19'TabSheetInheritance'#7'Caption'#6#11'Inheritance'#12'ClientHe' +'TTabSheet'#19'TabSheetInheritance'#7'Caption'#6#11'Inheritance'#12'ClientHe'
+'ight'#3#191#1#11'ClientWidth'#3#224#0#0#6'TPanel'#6'Panel6'#6'Height'#3#191 +'ight'#3#191#1#11'ClientWidth'#3#223#0#0#6'TPanel'#6'Panel6'#6'Height'#3#191
+#1#5'Width'#3#224#0#5'Align'#7#8'alClient'#10'BevelOuter'#7#6'bvNone'#11'Bor' +#1#5'Width'#3#223#0#5'Align'#7#8'alClient'#10'BevelOuter'#7#6'bvNone'#11'Bor'
+'derWidth'#2#5#12'ClientHeight'#3#191#1#11'ClientWidth'#3#224#0#8'TabOrder'#2 +'derWidth'#2#5#12'ClientHeight'#3#191#1#11'ClientWidth'#3#223#0#8'TabOrder'#2
+#0#0#9'TTreeView'#15'TreeInheritance'#4'Left'#2#5#6'Height'#3#181#1#3'Top'#2 +#0#0#9'TTreeView'#15'TreeInheritance'#4'Left'#2#5#6'Height'#3#181#1#3'Top'#2
+#5#5'Width'#3#214#0#5'Align'#7#8'alClient'#17'DefaultItemHeight'#2#14#8'Read' +#5#5'Width'#3#213#0#5'Align'#7#8'alClient'#17'DefaultItemHeight'#2#14#8'Read'
+'Only'#9#8'TabOrder'#2#0#12'OnCollapsing'#7#22'TreePalletteCollapsing'#10'On' +'Only'#9#8'TabOrder'#2#0#10'OnDblClick'#7#23'TreeInheritanceDblClick'#7'Opti'
+'DblClick'#7#23'TreeInheritanceDblClick'#7'Options'#11#17'tvoAutoItemHeight' +'ons'#11#17'tvoAutoItemHeight'#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'
+#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#14'tvoShowBu' +#11'tvoReadOnly'#14'tvoShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoT'
+'ttons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#0#0#0#0#0#0 +'oolTips'#22'tvoNoDoubleClickExpand'#0#0#0#0#0#0#0#0#0
]); ]);

View File

@ -43,10 +43,9 @@ uses
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, FormEditingIntf, LazarusIDEStrConsts, ExtCtrls, ComCtrls, StdCtrls, Buttons, FormEditingIntf, LazarusIDEStrConsts, ExtCtrls, ComCtrls,
ComponentPalette, ComponentReg, PackageDefs, ExtDlgs, FormEditor, PropEdits, ComponentPalette, ComponentReg, PackageDefs, ExtDlgs, FormEditor, PropEdits,
LCLType; LCLType, Menus;
type type
{ TComponentListForm } { TComponentListForm }
TComponentListForm = class(TForm) TComponentListForm = class(TForm)
@ -69,10 +68,9 @@ type
TabSheetInheritance: TTabSheet; TabSheetInheritance: TTabSheet;
procedure CloseButtonClick(Sender: TObject); procedure CloseButtonClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormShow(Sender: TObject);
procedure ListboxComponentsDblClick(Sender: TObject); procedure ListboxComponentsDblClick(Sender: TObject);
procedure TreeInheritanceDblClick ( Sender: TObject ) ; procedure TreeInheritanceDblClick ( Sender: TObject ) ;
procedure TreePalletteCollapsing(Sender: TObject; Node: TTreeNode;
var AllowCollapse: Boolean);
procedure TreePalletteDblClick(Sender: TObject); procedure TreePalletteDblClick(Sender: TObject);
procedure UpdateComponentSelection(Sender: TObject); procedure UpdateComponentSelection(Sender: TObject);
private private
@ -106,6 +104,8 @@ begin
TabSheetPaletteTree.Caption := lisCmpLstPalette; TabSheetPaletteTree.Caption := lisCmpLstPalette;
TabSheetInheritance.Caption := lisCmpLstInheritance; TabSheetInheritance.Caption := lisCmpLstInheritance;
//PLEASE add a defaultpage property in TPagecontrol
PageControl.ActivePage := TabSheetListBox;
FindAllLazarusComponents; FindAllLazarusComponents;
UpdateComponentSelection(nil); UpdateComponentSelection(nil);
@ -198,6 +198,7 @@ begin
//Third tabsheet (component inheritence) //Third tabsheet (component inheritence)
List := TStringlist.Create;
AClassList:= TStringlist.Create; AClassList:= TStringlist.Create;
TreeInheritance.Items.BeginUpdate; TreeInheritance.Items.BeginUpdate;
try try
@ -206,50 +207,51 @@ begin
AClassList.CaseSensitive := false; AClassList.CaseSensitive := false;
AClassList.Duplicates := dupIgnore; AClassList.Duplicates := dupIgnore;
List := TStringlist.Create;
for i := 0 to FComponentList.Count-1 do for i := 0 to FComponentList.Count-1 do
begin begin
AComponent := TRegisteredComponent(FComponentList[i]); AComponent := TRegisteredComponent(FComponentList[i]);
if not AComponent.Visible then continue;
AClassName := AComponent.ComponentClass.ClassName; AClassName := AComponent.ComponentClass.ClassName;
if (AFilter <> '') and (Pos(AFilter, UpperCase(AClassName)) = 0) then Continue; if (AFilter='') or (Pos(AFilter, UpperCase(AClassName))>0)then
// walk down to parent, stop on tcomponent, since components are at least
// a tcomponent descendant
List.Clear;
AClass := AComponent.ComponentClass;
while (AClass.ClassInfo <> nil) and (AClass.ClassType <> TComponent.ClassType) do
begin begin
List.AddObject(AClass.ClassName, TObject(AClass));
AClass := AClass.ClassParent;
end;
//build the tree // walk down to parent, stop on tcomponent, since components are at least
for j := List.Count - 1 downto 0 do // a tcomponent descendant
begin List.Clear;
AClass := TClass(List.Objects[j]); AClass := AComponent.ComponentClass;
AClassName := List[j]; while (AClass.ClassInfo <> nil) and (AClass.ClassType <> TComponent.ClassType) do
begin
List.AddObject(AClass.ClassName, TObject(AClass));
AClass := AClass.ClassParent;
end;
if not AClassList.Find(AClassName, AIndex) //build the tree
then begin for j := List.Count - 1 downto 0 do
//find out parent position begin
if Assigned(AClass.ClassParent) and AClassList.Find(AClass.ClassParent.ClassName, AIndex) AClass := TClass(List.Objects[j]);
then ANode := TTreeNode(AClassList.Objects[AIndex]) AClassName := List[j];
else ANode := nil;
//add the item if not AClassList.Find(AClassName, AIndex)
if AClassName <> AComponent.ComponentClass.ClassName then begin
then ANode := TreeInheritance.Items.AddChild(ANode, AClassName) //find out parent position
else ANode := TreeInheritance.Items.AddChildObject(ANode, AClassName, AComponent); if Assigned(AClass.ClassParent) and AClassList.Find(AClass.ClassParent.ClassName, AIndex)
AClassList.AddObject(AClassName, ANode); then ANode := TTreeNode(AClassList.Objects[AIndex])
else ANode := nil;
//add the item
if AClassName <> AComponent.ComponentClass.ClassName
then ANode := TreeInheritance.Items.AddChild(ANode, AClassName)
else ANode := TreeInheritance.Items.AddChildObject(ANode, AClassName, AComponent);
AClassList.AddObject(AClassName, ANode);
end;
end; end;
end; end;
end; end;
FreeAndNil(List);
TreeInheritance.AlphaSort; TreeInheritance.AlphaSort;
TreeInheritance.FullExpand; TreeInheritance.FullExpand;
finally finally
List.Free;
AClassList.Free; AClassList.Free;
TreeInheritance.Items.EndUpdate; TreeInheritance.Items.EndUpdate;
end; end;
@ -267,9 +269,9 @@ var
TypeClass: TComponentClass; TypeClass: TComponentClass;
X, Y: integer; X, Y: integer;
begin begin
//TComponentPalette(IDEComponentPalette).Selected := AComponent;
if not Assigned(AComponent) then Exit; if not Assigned(AComponent) then Exit;
if not Assigned(FormEditingHook) then Exit; if not Assigned(FormEditingHook) then Exit;
//TComponentPalette(IDEComponentPalette).Selected := AComponent;
TypeClass:=AComponent.ComponentClass; TypeClass:=AComponent.ComponentClass;
ParentCI:=FormEditingHook.GetDefaultComponentParent(TypeClass); ParentCI:=FormEditingHook.GetDefaultComponentParent(TypeClass);
@ -314,21 +316,22 @@ begin
AddSelectedComponent(AComponent); AddSelectedComponent(AComponent);
end; end;
procedure TComponentListForm.CloseButtonClick(Sender: TObject); procedure TComponentListForm.CloseButtonClick(Sender: TObject);
begin begin
Close; Close;
end; end;
procedure TComponentListForm.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure TComponentListForm.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
//Close form on Esc (Not really needed but nice behaviour)
begin begin
if Key=VK_ESCAPE if Key=VK_ESCAPE
then Close; then Close;
end; end;
procedure TComponentListForm.TreePalletteCollapsing(Sender: TObject; Node: TTreeNode; var AllowCollapse: Boolean); procedure TComponentListForm.FormShow(Sender: TObject);
begin begin
AllowCollapse:=false; if PatternEdit.Canfocus
then PatternEdit.SetFocus;
end; end;