24
procedure TUNBPage.SetParent(AParent: TWinControl);
22
procedure TPage.SetParent(AParent: TWinControl);
26
24
OldParent: TWinControl;
27
ParentNotebook: TUntabbedNotebook;
25
ParentNotebook: TNotebook;
30
28
if (AParent = Parent) {or (pfInserting in FFlags)} then Exit;
32
30
OldParent := Parent;
33
31
if (OldParent <> AParent) and (OldParent <> nil) and
34
(OldParent is TUntabbedNotebook) {and (not (pfRemoving in FFlags))} then
32
(OldParent is TNotebook) {and (not (pfRemoving in FFlags))} then
36
34
// remove from old pagelist
37
ParentNotebook := TUntabbedNotebook(OldParent);
35
ParentNotebook := TNotebook(OldParent);
38
36
i := ParentNotebook.FPageList.IndexOf(Self);
39
37
ParentNotebook.Pages.Delete(i);
42
40
inherited SetParent(AParent);
44
if (Parent <> nil) and (Parent is TUntabbedNotebook) then
42
if (Parent <> nil) and (Parent is TNotebook) then
46
44
// add to new pagelist
47
ParentNotebook := TUntabbedNotebook(Parent);
45
ParentNotebook := TNotebook(Parent);
48
46
i := ParentNotebook.FPageList.IndexOf(Self);
50
48
ParentNotebook.InsertPage(Self, ParentNotebook.Pages.Count);
54
constructor TUNBPage.Create(TheOwner: TComponent);
52
constructor TPage.Create(TheOwner: TComponent);
56
54
inherited Create(TheOwner);
67
destructor TUNBPage.Destroy;
65
destructor TPage.Destroy;
69
67
{$ifdef DEBUG_NEW_NOTEBOOK}
70
DebugLn('[TUNBPage.Destroy]');
68
DebugLn('[TPage.Destroy]');
73
if (Parent <> nil) and (Parent is TUntabbedNotebook) then
71
if (Parent <> nil) and (Parent is TNotebook) then
75
73
{$ifdef DEBUG_NEW_NOTEBOOK}
76
DebugLn('[TUNBPage.Destroy] FPageList.Remove(Self)');
74
DebugLn('[TPage.Destroy] FPageList.Remove(Self)');
78
TUntabbedNotebook(Parent).FPageList.Remove(Self);
76
TNotebook(Parent).FPageList.Remove(Self);