IDEIntf: improve set active page in designer on OI selection change.

git-svn-id: trunk@52344 -
This commit is contained in:
ondrej 2016-05-22 10:51:17 +00:00
parent d22c7ed37a
commit bd2fb1f4bc
2 changed files with 33 additions and 7 deletions

View File

@ -308,13 +308,7 @@ begin
if NewSelection.IsEqual(FComponentList.Selection) then
Exit;
FComponentList.Selection.Assign(NewSelection);
if (NewSelection.Count=1) and
(NewSelection[0] is TCustomPage) and
(TCustomPage(NewSelection[0]).Parent is TCustomTabControl) then
begin
TCustomTabControl(TCustomPage(NewSelection[0]).Parent).PageIndex :=
TCustomPage(NewSelection[0]).PageIndex;
end;
inherited DoSelectionChanged;
finally
NewSelection.Free;

View File

@ -742,6 +742,7 @@ type
FRefreshingSelectionCount: integer;
FOnAutoShow: TNotifyEvent;
FLastActiveRowName: String;
procedure DefSelectionVisibleInDesigner;
function GetComponentPanelHeight: integer;
function GetInfoBoxHeight: integer;
procedure SetEnableHookGetSelection(AValue: boolean);
@ -4818,6 +4819,7 @@ begin
if FSelection.IsEqual(ComponentTree.Selection) then exit;
FSelection.Assign(ComponentTree.Selection);
RefreshSelection;
DefSelectionVisibleInDesigner;
if Assigned(FOnSelectPersistentsInOI) then
FOnSelectPersistentsInOI(Self);
end;
@ -5221,6 +5223,36 @@ begin
end;
end;
procedure TObjectInspectorDlg.DefSelectionVisibleInDesigner;
procedure ShowPage(const aPage: TTabSheet);
begin
if aPage.Parent is TPageControl then
TPageControl(aPage.Parent).PageIndex := aPage.PageIndex;
end;
procedure ShowPage(const aPage: TPage);
begin
if aPage.Parent is TNotebook then
TNotebook(aPage.Parent).PageIndex := aPage.PageIndex;
end;
var
Cnt: TControl;
begin
if (Selection.Count = 0) or (Selection[0] = nil) or not(Selection[0] is TControl) then
Exit;
Cnt := TControl(Selection[0]);
while Cnt<>nil do
begin
if Cnt is TTabSheet then
ShowPage(TTabSheet(Cnt))
else
if Cnt is TPage then
ShowPage(TPage(Cnt));
Cnt := Cnt.Parent;
end;
end;
procedure TObjectInspectorDlg.CreateBottomSplitter;
// vertical splitter between notebook and info panel
begin