Fixes wince popup menus, bug #14560

git-svn-id: trunk@21652 -
This commit is contained in:
sekelsenmat 2009-09-11 19:11:30 +00:00
parent 0db8bb8288
commit 415177dd6d
3 changed files with 14 additions and 9 deletions

View File

@ -139,10 +139,12 @@ type
TWinCEWidgetSet = class(TWidgetSet) TWinCEWidgetSet = class(TWidgetSet)
private private
// The parent of all windows, represents the button of the taskbar // In win32 it was: The parent of all windows, represents the button of the taskbar
// This window is also the owner of the clipboard. // In wince it is just an invisible window, but retains the following functions:
// Assoc. windowproc also acts as handler for popup menus // * This window is also the owner of the clipboard.
FAppHandle: HWND;//roozbeh:in win32 it was parrent of all..a window on taskbar // * Assoc. windowproc also acts as handler for popup menus
// * It is indispensable for popupmenus and thread synchronization
FAppHandle: HWND;
FMetrics: TNonClientMetrics; FMetrics: TNonClientMetrics;
FMetricsFailed: Boolean; FMetricsFailed: Boolean;

View File

@ -147,14 +147,15 @@ begin
end; end;
// Create parent of all windows, 'button on taskbar' // Create parent of all windows, 'button on taskbar'
// does this work on wince?! // The AppHandle window is necessary for popupmenus and
(*FAppHandle := CreateWindowExW(0, @ClsName, // many other features, see bug 14560
FAppHandle := CreateWindowExW(0, @ClsName,
PWideChar(UTF8Decode(Application.Title)), PWideChar(UTF8Decode(Application.Title)),
WS_POPUP or WS_CLIPSIBLINGS {or WS_CAPTION} or WS_SYSMENU or WS_MINIMIZEBOX, WS_POPUP or WS_CLIPSIBLINGS or WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX,
0, {Windows.GetSystemMetrics(SM_CXSCREEN) div 2,} 0, {Windows.GetSystemMetrics(SM_CXSCREEN) div 2,}
0, {Windows.GetSystemMetrics(SM_CYSCREEN) div 2,} 0, {Windows.GetSystemMetrics(SM_CYSCREEN) div 2,}
0, 0, HWND(nil), HMENU(nil), HInstance, nil); 0, 0, HWND(nil), HMENU(nil), HInstance, nil);
AllocWindowInfo(FAppHandle);*) AllocWindowInfo(FAppHandle);
// set nice main icon // set nice main icon
SendMessage(FAppHandle, WM_SETICON, ICON_BIG, SendMessage(FAppHandle, WM_SETICON, ICON_BIG,

View File

@ -158,7 +158,9 @@ begin
if AWinControl.Parent <> nil then if AWinControl.Parent <> nil then
Parent := AWinControl.Parent.Handle Parent := AWinControl.Parent.Handle
else else
Parent := TWinCEWidgetSet(WidgetSet).AppHandle; // Never set the parent of a window to AppHandle,
// otherwise wince will really try to make it a child
Parent := 0;
SubClassWndProc := @WindowProc; SubClassWndProc := @WindowProc;
StrCaption := AWinControl.Caption; StrCaption := AWinControl.Caption;