mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-30 10:01:36 +01:00
ComponentList: Prevent component selection on startup also when undocked. Check HostDockSite instead of Parent.
git-svn-id: trunk@51397 -
This commit is contained in:
parent
3fc41dac19
commit
44e2d8db69
@ -86,7 +86,7 @@ type
|
|||||||
// List for Component inheritence view
|
// List for Component inheritence view
|
||||||
FClassList: TStringList;
|
FClassList: TStringList;
|
||||||
FKeepSelected: Boolean;
|
FKeepSelected: Boolean;
|
||||||
FFirstTimeAnchored: Boolean;
|
FInitialized: Boolean;
|
||||||
FIgnoreSelection: Boolean;
|
FIgnoreSelection: Boolean;
|
||||||
FPageControlChange: Boolean;
|
FPageControlChange: Boolean;
|
||||||
FActiveTree: TTreeView;
|
FActiveTree: TTreeView;
|
||||||
@ -156,31 +156,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentListForm.FormShow(Sender: TObject);
|
procedure TComponentListForm.FormShow(Sender: TObject);
|
||||||
var
|
|
||||||
ParentParent: TWinControl; // Used for checking if the form is anchored.
|
|
||||||
begin
|
begin
|
||||||
ParentParent := Nil;
|
|
||||||
if Assigned(Parent) then
|
|
||||||
ParentParent := Parent.Parent;
|
|
||||||
//DebugLn(['*** TComponentListForm.FormShow, Parent=', Parent, ', Parent.Parent=', ParentParent]);
|
//DebugLn(['*** TComponentListForm.FormShow, Parent=', Parent, ', Parent.Parent=', ParentParent]);
|
||||||
ButtonPanel.Visible := ParentParent=Nil;
|
ButtonPanel.Visible := (HostDockSite=Nil) or (HostDockSite.Parent=Nil);
|
||||||
if ButtonPanel.Visible then begin
|
if ButtonPanel.Visible then
|
||||||
|
begin // ComponentList is undocked
|
||||||
PageControl.AnchorSideBottom.Side := asrTop;
|
PageControl.AnchorSideBottom.Side := asrTop;
|
||||||
UpdateButtonState;
|
UpdateButtonState;
|
||||||
end
|
if TreeFilterEd.CanFocus then // Focus filter if window is undocked
|
||||||
else
|
|
||||||
begin
|
|
||||||
PageControl.AnchorSideBottom.Side := asrBottom;
|
|
||||||
// Only with AnchorDocking. This is a temporary solution, many usability issues remain.
|
|
||||||
FFirstTimeAnchored := True;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if not Assigned(Parent) then //only in undocked IDE
|
|
||||||
begin
|
|
||||||
if TreeFilterEd.CanFocus then
|
|
||||||
TreeFilterEd.SetFocus;
|
TreeFilterEd.SetFocus;
|
||||||
TreeFilterEd.SelectAll;
|
TreeFilterEd.SelectAll;
|
||||||
end;
|
end
|
||||||
|
else // ComponentList is docked
|
||||||
|
PageControl.AnchorSideBottom.Side := asrBottom;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentListForm.FormActivate(Sender: TObject);
|
procedure TComponentListForm.FormActivate(Sender: TObject);
|
||||||
@ -400,16 +388,8 @@ procedure TComponentListForm.ListTreeSelectionChanged(Sender: TObject);
|
|||||||
var
|
var
|
||||||
AComponent: TRegisteredComponent;
|
AComponent: TRegisteredComponent;
|
||||||
begin
|
begin
|
||||||
if FFirstTimeAnchored then
|
if FInitialized then
|
||||||
begin
|
begin
|
||||||
// Only run once when the anchored IDE starts.
|
|
||||||
FFirstTimeAnchored := False;
|
|
||||||
IDEComponentPalette.SetSelectedComp(nil, False);
|
|
||||||
ListTree.Selected := Nil;
|
|
||||||
PalletteTree.Selected := Nil;
|
|
||||||
InheritanceTree.Selected := Nil;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
if FPageControlChange then
|
if FPageControlChange then
|
||||||
Exit;
|
Exit;
|
||||||
AComponent:=GetSelectedComponent;
|
AComponent:=GetSelectedComponent;
|
||||||
@ -422,7 +402,15 @@ begin
|
|||||||
FIgnoreSelection := False;
|
FIgnoreSelection := False;
|
||||||
end;
|
end;
|
||||||
UpdateButtonState;
|
UpdateButtonState;
|
||||||
end;
|
end
|
||||||
|
else begin
|
||||||
|
// Only run once when the IDE starts.
|
||||||
|
FInitialized := True;
|
||||||
|
IDEComponentPalette.SetSelectedComp(nil, False);
|
||||||
|
ListTree.Selected := Nil;
|
||||||
|
PalletteTree.Selected := Nil;
|
||||||
|
InheritanceTree.Selected := Nil;
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentListForm.TreeKeyPress(Sender: TObject; var Key: char);
|
procedure TComponentListForm.TreeKeyPress(Sender: TObject; var Key: char);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user