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)
private
// The parent of all windows, represents the button of the taskbar
// This window is also the owner of the clipboard.
// Assoc. windowproc also acts as handler for popup menus
FAppHandle: HWND;//roozbeh:in win32 it was parrent of all..a window on taskbar
// In win32 it was: The parent of all windows, represents the button of the taskbar
// In wince it is just an invisible window, but retains the following functions:
// * This window is also the owner of the clipboard.
// * Assoc. windowproc also acts as handler for popup menus
// * It is indispensable for popupmenus and thread synchronization
FAppHandle: HWND;
FMetrics: TNonClientMetrics;
FMetricsFailed: Boolean;

View File

@ -147,14 +147,15 @@ begin
end;
// Create parent of all windows, 'button on taskbar'
// does this work on wince?!
(*FAppHandle := CreateWindowExW(0, @ClsName,
// The AppHandle window is necessary for popupmenus and
// many other features, see bug 14560
FAppHandle := CreateWindowExW(0, @ClsName,
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_CYSCREEN) div 2,}
0, 0, HWND(nil), HMENU(nil), HInstance, nil);
AllocWindowInfo(FAppHandle);*)
AllocWindowInfo(FAppHandle);
// set nice main icon
SendMessage(FAppHandle, WM_SETICON, ICON_BIG,

View File

@ -158,7 +158,9 @@ begin
if AWinControl.Parent <> nil then
Parent := AWinControl.Parent.Handle
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;
StrCaption := AWinControl.Caption;