mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-01 15:32:35 +02:00
LCL: fixed removing TCustomPage pfAdded when destroying handle
git-svn-id: trunk@11991 -
This commit is contained in:
parent
4647c02ff0
commit
b514d80686
@ -69,6 +69,7 @@ type
|
||||
function DialogChar(var Message: TLMKey): boolean; override;
|
||||
procedure DoHide; dynamic;
|
||||
procedure DoShow; dynamic;
|
||||
procedure DestroyHandle; override;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
procedure AdjustClientRect(var ARect: TRect); override;
|
||||
|
@ -18,7 +18,7 @@
|
||||
*****************************************************************************
|
||||
}
|
||||
|
||||
{ $DEFINE NOTEBOOK_DEBUG}
|
||||
{off $DEFINE NOTEBOOK_DEBUG}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TNBPages Constructor
|
||||
@ -544,12 +544,18 @@ procedure TCustomNoteBook.AddRemovePageHandle(APage: TCustomPage);
|
||||
begin
|
||||
if (not (csDestroying in APage.ComponentState))
|
||||
and (APage.TabVisible or (csDesigning in ComponentState)) then begin
|
||||
{$IFDEF NOTEBOOK_DEBUG}
|
||||
DebugLn(['TCustomNoteBook.AddRemovePageHandle ADD ',DbgSName(APage),' pfAdded=',pfAdded in APage.FFlags]);
|
||||
{$ENDIF}
|
||||
if (pfAdded in APage.FFlags) then exit;
|
||||
Include(APage.FFlags,pfAdding);
|
||||
TWSCustomNotebookClass(WidgetSetClass).AddPage(Self, APage, APage.VisibleIndex);
|
||||
APage.FFlags:=APage.FFlags+[pfAdded]-[pfAdding];
|
||||
APage.ResizeDelayedAutoSizeChildren
|
||||
end else begin
|
||||
{$IFDEF NOTEBOOK_DEBUG}
|
||||
DebugLn(['TCustomNoteBook.AddRemovePageHandle REMOVE ',DbgSName(APage),' pfAdded=',pfAdded in APage.FFlags]);
|
||||
{$ENDIF}
|
||||
if not (pfAdded in APage.FFlags) then exit;
|
||||
Exclude(APage.FFlags,pfAdded);
|
||||
TWSCustomNotebookClass(WidgetSetClass).RemovePage(Self, APage.VisibleIndex);
|
||||
|
@ -200,6 +200,12 @@ begin
|
||||
FOnShow(Self);
|
||||
end;
|
||||
|
||||
procedure TCustomPage.DestroyHandle;
|
||||
begin
|
||||
inherited DestroyHandle;
|
||||
Exclude(FFlags,pfAdded);
|
||||
end;
|
||||
|
||||
function TCustomPage.IsControlVisible: Boolean;
|
||||
begin
|
||||
if Parent is TCustomNotebook then
|
||||
|
@ -3402,8 +3402,8 @@ begin
|
||||
Include(FControlState, csDestroyingHandle);
|
||||
if FWinControls <> nil then begin
|
||||
for i:= 0 to FWinControls.Count - 1 do begin
|
||||
//DebugLn(' i=',i);
|
||||
//DebugLn(' ',TWinControl(FWinControls[i]).Name,':',TWinControl(FWinControls[i]).ClassName);
|
||||
//DebugLn([' i=',i]);
|
||||
//DebugLn([' ',TWinControl(FWinControls[i]).Name,':',TWinControl(FWinControls[i]).ClassName]);
|
||||
AWinControl:=TWinControl(FWinControls[i]);
|
||||
if AWinControl.HandleAllocated then
|
||||
AWinControl.DestroyHandle;
|
||||
|
@ -243,7 +243,8 @@ var
|
||||
begin
|
||||
if OldNoteBookButtonPress = nil then
|
||||
HookNoteBookClass;
|
||||
P := PGtkNoteBook(inherited CreateHandle(AWinControl, AParams));
|
||||
//DebugLn(['TGtk2WSCustomNotebook.CreateHandle ',DbgSName(AWinControl)]);
|
||||
P := PGtkNoteBook(TGtkWSCustomNotebook.CreateHandle(AWinControl, AParams));
|
||||
Result := HWND(P);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user