IDE: component list: select and close

git-svn-id: trunk@35064 -
This commit is contained in:
mattias 2012-01-31 14:49:31 +00:00
parent e384b4c266
commit d273b4fcd8
2 changed files with 21 additions and 0 deletions

View File

@ -8,6 +8,7 @@ object ComponentListForm: TComponentListForm
ClientHeight = 556
ClientWidth = 338
KeyPreview = True
OnClose = FormClose
OnKeyDown = FormKeyDown
Position = poScreenCenter
LCLVersion = '0.9.31'

View File

@ -62,6 +62,7 @@ type
procedure ComponentsListboxDblClick(Sender: TObject);
procedure ComponentsListboxDrawItem(Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure TreeCustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
procedure ComponentsListboxKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
@ -360,6 +361,25 @@ begin
end;
end;
procedure TComponentListForm.FormClose(Sender: TObject;
var CloseAction: TCloseAction);
begin
// Using a dock manager...
if Parent<>nil then
begin
CloseAction := caNone;
//todo: helper function in DockManager or IDEDockMaster for closing forms.
// Only close the window if it's floating.
// AnchorDocking doesn't seem to initialize 'FloatingDockSiteClass' so we can't just check 'Floating'.
// Also, AnchorDocking use nested forms, so the check for HostDockSite.Parent.
if Assigned(HostDockSite) and (HostDockSite.DockClientCount <= 1)
and (HostDockSite is TCustomForm) and (HostDockSite.Parent = nil) then
begin
TCustomForm(HostDockSite).Close;
end;
end;
end;
procedure TComponentListForm.TreeCustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
var