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