mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-07 22:59:55 +01:00
Implements loading/saving the state of the pages properly in the form designer for TUntabbedNotebook
git-svn-id: trunk@27142 -
This commit is contained in:
parent
44e4879443
commit
230ddb896f
@ -322,6 +322,8 @@ type
|
|||||||
{ TUNBPage }
|
{ TUNBPage }
|
||||||
|
|
||||||
TUNBPage = class(TCustomControl)
|
TUNBPage = class(TCustomControl)
|
||||||
|
protected
|
||||||
|
procedure SetParent(AParent: TWinControl); override;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -382,10 +384,39 @@ type
|
|||||||
// property PageCount: integer read GetPageCount;
|
// property PageCount: integer read GetPageCount;
|
||||||
// property PageList: TList read FPageList;
|
// property PageList: TList read FPageList;
|
||||||
published
|
published
|
||||||
// property TabStop default true;
|
// TUntabbedNotebook specific properties
|
||||||
property PageIndex: Integer read GetPageIndex write SetPageIndex default -1;
|
property PageIndex: Integer read GetPageIndex write SetPageIndex default -1;
|
||||||
property Pages: TStrings read FPages;
|
property Pages: TStrings read FPages;
|
||||||
// property ActivePage: String read GetActivePage write SetActivePage;
|
// property ActivePage: String read GetActivePage write SetActivePage;
|
||||||
|
// Generic properties
|
||||||
|
property Align;
|
||||||
|
property Anchors;
|
||||||
|
property BorderSpacing;
|
||||||
|
property Constraints;
|
||||||
|
property DragCursor;
|
||||||
|
property DragMode;
|
||||||
|
property Enabled;
|
||||||
|
property OnChangeBounds;
|
||||||
|
// property OnChanging;
|
||||||
|
property OnContextPopup;
|
||||||
|
property OnDragDrop;
|
||||||
|
property OnDragOver;
|
||||||
|
property OnEndDrag;
|
||||||
|
property OnEnter;
|
||||||
|
property OnExit;
|
||||||
|
property OnMouseDown;
|
||||||
|
property OnMouseEnter;
|
||||||
|
property OnMouseLeave;
|
||||||
|
property OnMouseMove;
|
||||||
|
property OnMouseUp;
|
||||||
|
// property OnPageChanged;
|
||||||
|
property OnResize;
|
||||||
|
property OnStartDrag;
|
||||||
|
// property Options;
|
||||||
|
// property PageIndex;
|
||||||
|
property PopupMenu;
|
||||||
|
property TabOrder;
|
||||||
|
property TabStop;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Timer }
|
{ Timer }
|
||||||
|
|||||||
@ -21,6 +21,36 @@
|
|||||||
|
|
||||||
{ TUNBPage }
|
{ TUNBPage }
|
||||||
|
|
||||||
|
procedure TUNBPage.SetParent(AParent: TWinControl);
|
||||||
|
var
|
||||||
|
OldParent: TWinControl;
|
||||||
|
ParentNotebook: TUntabbedNotebook;
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
if (AParent = Parent) {or (pfInserting in FFlags)} then Exit;
|
||||||
|
|
||||||
|
OldParent := Parent;
|
||||||
|
if (OldParent <> AParent) and (OldParent <> nil) and
|
||||||
|
(OldParent is TUntabbedNotebook) {and (not (pfRemoving in FFlags))} then
|
||||||
|
begin
|
||||||
|
// remove from old pagelist
|
||||||
|
ParentNotebook := TUntabbedNotebook(OldParent);
|
||||||
|
i := ParentNotebook.FPageList.IndexOf(Self);
|
||||||
|
ParentNotebook.Pages.Delete(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
inherited SetParent(AParent);
|
||||||
|
|
||||||
|
if (Parent <> nil) and (Parent is TUntabbedNotebook) then
|
||||||
|
begin
|
||||||
|
// add to new pagelist
|
||||||
|
ParentNotebook := TUntabbedNotebook(Parent);
|
||||||
|
i := ParentNotebook.FPageList.IndexOf(Self);
|
||||||
|
if i < 0 then
|
||||||
|
ParentNotebook.InsertPage(Self, ParentNotebook.Pages.Count);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TUNBPage.Create(TheOwner: TComponent);
|
constructor TUNBPage.Create(TheOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user