diff --git a/components/ideintf/componenttreeview.pas b/components/ideintf/componenttreeview.pas index c924131363..7fe2ab4bcd 100644 --- a/components/ideintf/componenttreeview.pas +++ b/components/ideintf/componenttreeview.pas @@ -25,7 +25,7 @@ interface uses Classes, SysUtils, TypInfo, LCLProc, AvgLvlTree, Dialogs, Controls, ComCtrls, - Graphics, ExtCtrls, LMessages, + Graphics, ExtCtrls, ObjInspStrConsts, PropEdits, PropEditUtils; type @@ -286,7 +286,6 @@ var ANode: TTreeNode; APersistent: TPersistent; NewSelection: TPersistentSelectionList; - Msg: TLMessage; begin NewSelection := TPersistentSelectionList.Create; try @@ -309,26 +308,13 @@ begin if NewSelection.IsEqual(FComponentList.Selection) then Exit; FComponentList.Selection.Assign(NewSelection); - if (NewSelection.Count=1) then + if (NewSelection.Count=1) and + (NewSelection[0] is TCustomPage) and + (TCustomPage(NewSelection[0]).Parent is TCustomTabControl) then begin - ANode := GetFirstMultiSelected; - FillChar(Msg{%H-}, SizeOf(Msg), 0); - Msg.msg := CM_OBJECTINSPECTORSELECT; - while Assigned(ANode) do - begin - APersistent := TPersistent(ANode.Data); - if Assigned(APersistent) then - begin - if APersistent is TControl then - TControl(APersistent).Perform(Msg.msg, Msg.wParam, Msg.lParam) - else // support TComponent(s) as well - APersistent.Dispatch(Msg); - end; - Msg.lParam := 1; // see comment at CM_OBJECTINSPECTORSELECT for more info - ANode := ANode.Parent; - end; + TCustomTabControl(TCustomPage(NewSelection[0]).Parent).PageIndex := + TCustomPage(NewSelection[0]).PageIndex; end; - inherited DoSelectionChanged; finally NewSelection.Free; diff --git a/lcl/comctrls.pp b/lcl/comctrls.pp index 72aad246ae..6a1c6e1452 100644 --- a/lcl/comctrls.pp +++ b/lcl/comctrls.pp @@ -244,7 +244,6 @@ type procedure SetParent(AParent: TWinControl); override; property Flags: TPageFlags read FFlags write FFlags; procedure CMHitTest(var Message: TLMNCHITTEST); message CM_HITTEST; - procedure CMObjectInspectorSelect(var Message: TLMessage); message CM_OBJECTINSPECTORSELECT; procedure CMVisibleChanged(var Message: TLMessage); message CM_VISIBLECHANGED; function GetPageIndex: integer; virtual; procedure SetPageIndex(AValue: Integer); virtual; diff --git a/lcl/extctrls.pp b/lcl/extctrls.pp index 25506100a3..1e31dcd7ce 100644 --- a/lcl/extctrls.pp +++ b/lcl/extctrls.pp @@ -42,15 +42,11 @@ type TPage = class(TCustomControl) private FOnBeforeShow: TBeforeShowPageEvent; - function GetPageIndex: Integer; protected - procedure CMObjectInspectorSelect(var Message: TLMessage); message CM_OBJECTINSPECTORSELECT; procedure SetParent(AParent: TWinControl); override; public constructor Create(TheOwner: TComponent); override; destructor Destroy; override; - public - property PageIndex: Integer read GetPageIndex; published // Lazarus-specific TPage events // OnBeforeShow occurs before a page is displayed, so that @@ -132,8 +128,8 @@ type { function TabIndexAtClientPos(ClientPos: TPoint): integer; function TabRect(AIndex: Integer): TRect; function GetImageIndex(ThePageIndex: Integer): Integer; virtual; + function IndexOf(APage: TCustomPage): integer; function CustomPage(Index: integer): TCustomPage;} - function IndexOf(APage: TPage): integer; public property ActivePage: String read GetActivePage;// write SetActivePage; // should not be published because the read can raise an exception property ActivePageComponent: TPage read GetActivePageComponent;// write SetActivePage; // should not be published because the read can raise an exception diff --git a/lcl/include/controlconsts.inc b/lcl/include/controlconsts.inc index 3402fa72c6..c713fe15cf 100644 --- a/lcl/include/controlconsts.inc +++ b/lcl/include/controlconsts.inc @@ -102,9 +102,8 @@ const CM_TABLETOPTIONSCHANGED = CM_BASE + 87 unimplemented; CM_PARENTTABLETOPTIONSCHANGED = CM_BASE + 88 unimplemented; // LCL only - CM_APPSHOWBTNGLYPHCHANGED = CM_BASE + CM_LCLOFFSET + 68; - CM_APPSHOWMENUGLYPHCHANGED = CM_BASE + CM_LCLOFFSET + 69; - CM_OBJECTINSPECTORSELECT = CM_BASE + CM_LCLOFFSET + 70; // sent when this or a child node is selected in the OI (LParam = 0 for this node, LParam = 1 for a child node) + CM_APPSHOWBTNGLYPHCHANGED = CM_BASE + CM_LCLOFFSET + 68; + CM_APPSHOWMENUGLYPHCHANGED = CM_BASE + CM_LCLOFFSET + 69; CN_BASE = $BC00; CN_CHARTOITEM = CN_BASE + LM_CHARTOITEM; diff --git a/lcl/include/custompage.inc b/lcl/include/custompage.inc index 97e89dcb59..f8377d26eb 100644 --- a/lcl/include/custompage.inc +++ b/lcl/include/custompage.inc @@ -195,12 +195,6 @@ begin FOnHide(Self); end; -procedure TCustomPage.CMObjectInspectorSelect(var Message: TLMessage); -begin - if (Parent is TCustomTabControl) and (csDesigning in ComponentState) then - TCustomTabControl(Parent).PageIndex := PageIndex; -end; - procedure TCustomPage.DoShow; begin if Assigned(FOnShow) then diff --git a/lcl/include/notebook.inc b/lcl/include/notebook.inc index a947eaec2b..c1fbf4fc2b 100644 --- a/lcl/include/notebook.inc +++ b/lcl/include/notebook.inc @@ -154,15 +154,6 @@ begin Result := FPageIndex; end; -function TNotebook.IndexOf(APage: TPage): integer; -begin - for Result := 0 to PageCount-1 do - if Page[Result] = APage then - Exit; - - Result := -1; -end; - procedure TNotebook.InsertPage(APage: TPage; Index: Integer); begin if FPageList.IndexOf(APage) >= 0 then Exit; diff --git a/lcl/include/page.inc b/lcl/include/page.inc index 6b8eee1dca..b1876a6210 100644 --- a/lcl/include/page.inc +++ b/lcl/include/page.inc @@ -56,12 +56,6 @@ begin Visible := False; end; -procedure TPage.CMObjectInspectorSelect(var Message: TLMessage); -begin - if (Parent is TNotebook) and (csDesigning in ComponentState) then - TNotebook(Parent).PageIndex := PageIndex; -end; - destructor TPage.Destroy; begin {$ifdef DEBUG_NEW_NOTEBOOK} @@ -79,13 +73,6 @@ begin inherited Destroy; end; -function TPage.GetPageIndex: Integer; -begin - if Parent is TNotebook then - Result := TNotebook(Parent).IndexOf(Self) - else - Result := -1; -end; // included by extctrls.pp