mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-11-04 00:40:03 +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 = class(TCustomControl)
 | 
			
		||||
  protected
 | 
			
		||||
    procedure SetParent(AParent: TWinControl); override;
 | 
			
		||||
  public
 | 
			
		||||
    constructor Create(TheOwner: TComponent); override;
 | 
			
		||||
    destructor Destroy; override;
 | 
			
		||||
@ -382,10 +384,39 @@ type
 | 
			
		||||
//    property PageCount: integer read GetPageCount;
 | 
			
		||||
//    property PageList: TList read FPageList;
 | 
			
		||||
  published
 | 
			
		||||
//    property TabStop default true;
 | 
			
		||||
    // TUntabbedNotebook specific properties
 | 
			
		||||
    property PageIndex: Integer read GetPageIndex write SetPageIndex default -1;
 | 
			
		||||
    property Pages: TStrings read FPages;
 | 
			
		||||
//    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;
 | 
			
		||||
 | 
			
		||||
  { Timer }
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,36 @@
 | 
			
		||||
 | 
			
		||||
{ 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);
 | 
			
		||||
begin
 | 
			
		||||
  inherited Create(TheOwner);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user