From 6ccb6125c6f6905c8c2dc1e158bbbf514df47746 Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 19 Oct 2007 11:20:22 +0000 Subject: [PATCH] win32(ce): fix deletion of notebook/pagecontrol page by RemovePage git-svn-id: trunk@12519 - --- lcl/interfaces/win32/win32wsextctrls.pp | 10 ++++++++-- lcl/interfaces/wince/wincewsextctrls.pp | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lcl/interfaces/win32/win32wsextctrls.pp b/lcl/interfaces/win32/win32wsextctrls.pp index 27d1e30328..a633cd3527 100644 --- a/lcl/interfaces/win32/win32wsextctrls.pp +++ b/lcl/interfaces/win32/win32wsextctrls.pp @@ -236,6 +236,10 @@ implementation uses Forms, LMessages, ShellAPI; +type + TCustomPageAccess = class(TCustomPage) + end; + function IsNotebookGroupFocused(const ANotebook: TCustomNotebook): boolean; var lNotebookHandle, lWindow: HWND; @@ -329,8 +333,10 @@ var PageIndex: integer; PageControlHandle: HWND; begin - // remove tab from pagecontrol - if (AWinControl.Parent <> nil) and (AWinControl.Parent.HandleAllocated) then + // remove tab from pagecontrol only if not pfRemoving is set + // if pfRemoving is set then Tab has been deleted by RemovePage + if (AWinControl.Parent <> nil) and (AWinControl.Parent.HandleAllocated) and + not (pfRemoving in TCustomPageAccess(AWinControl).Flags) then begin PageControlHandle := AWinControl.Parent.Handle; PageIndex := TCustomPage(AWinControl).PageIndex; diff --git a/lcl/interfaces/wince/wincewsextctrls.pp b/lcl/interfaces/wince/wincewsextctrls.pp index c136a2c863..926e7848d4 100644 --- a/lcl/interfaces/wince/wincewsextctrls.pp +++ b/lcl/interfaces/wince/wincewsextctrls.pp @@ -223,6 +223,10 @@ implementation uses LMessages; +type + TCustomPageAccess = class(TCustomPage) + end; + function IsNotebookGroupFocused(const ANotebook: TCustomNotebook): boolean; var lNotebookHandle, lWindow: HWND; @@ -309,8 +313,10 @@ var PageIndex: integer; PageControlHandle: HWND; begin - // remove tab from pagecontrol - if (AWinControl.Parent <> nil) and (AWinControl.Parent.HandleAllocated) then + // remove tab from pagecontrol only if not pfRemoving is set + // if pfRemoving is set then Tab has been deleted by RemovePage + if (AWinControl.Parent <> nil) and (AWinControl.Parent.HandleAllocated) and + not (pfRemoving in TCustomPageAccess(AWinControl).Flags) then begin PageControlHandle := AWinControl.Parent.Handle; PageIndex := TCustomPage(AWinControl).PageIndex;