Activates menu support for wince-win32

git-svn-id: trunk@22245 -
This commit is contained in:
sekelsenmat 2009-10-20 13:53:49 +00:00
parent 244afd1998
commit a8faf01cf3
2 changed files with 11 additions and 4 deletions

View File

@ -2434,10 +2434,12 @@ begin
end; end;
function TWinCEWidgetSet.SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; function TWinCEWidgetSet.SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean;
{$ifndef Win32}
var var
lLCLMenu: TMenu; lLCLMenu: TMenu;
i: Integer; i: Integer;
begin begin
Result := False;
for i := 0 to WinCEWSMenus.MenuHandleList.Count - 1 do for i := 0 to WinCEWSMenus.MenuHandleList.Count - 1 do
if WinCEWSMenus.MenuHandleList.Items[i] = Pointer(AMenuHandle) then Break; if WinCEWSMenus.MenuHandleList.Items[i] = Pointer(AMenuHandle) then Break;
lLCLMenu := TMenu(MenuLCLObjectList.Items[i]); lLCLMenu := TMenu(MenuLCLObjectList.Items[i]);
@ -2446,6 +2448,11 @@ begin
AddToChangedMenus(AWindowHandle); AddToChangedMenus(AWindowHandle);
Result := True; Result := True;
end; end;
{$else}
begin
Result := Windows.SetMenu(AWindowHandle, AMenuHandle);
end;
{$endif}
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------

View File

@ -93,7 +93,9 @@ var
MenuHandleList, MenuLCLObjectList: TFPList; MenuHandleList, MenuLCLObjectList: TFPList;
function FindMenuItemAccelerator(const ACharCode: char; const AMenuHandle: HMENU): integer; function FindMenuItemAccelerator(const ACharCode: char; const AMenuHandle: HMENU): integer;
{$ifndef Win32}
procedure CeSetMenu(Wnd: HWND; Menu: HMENU; LCLMenu: TMenu); procedure CeSetMenu(Wnd: HWND; Menu: HMENU; LCLMenu: TMenu);
{$endif}
implementation implementation
@ -115,6 +117,7 @@ type
//menus //menus
{$ifndef Win32}
//both menus are popup menus or submenus //both menus are popup menus or submenus
procedure CeMakeMenuesSame(SrcMenu,dstMenu : HMENU); procedure CeMakeMenuesSame(SrcMenu,dstMenu : HMENU);
var var
@ -158,7 +161,6 @@ end;
associates a menu with a window. associates a menu with a window.
} }
procedure CeSetMenu(Wnd: HWND; Menu: HMENU; LCLMenu: TMenu); procedure CeSetMenu(Wnd: HWND; Menu: HMENU; LCLMenu: TMenu);
{$ifndef Win32}
var var
mbi: SHMENUBARINFO; mbi: SHMENUBARINFO;
mi: MENUITEMINFO; mi: MENUITEMINFO;
@ -170,9 +172,7 @@ var
LeftMenuCount: Integer = -1; LeftMenuCount: Integer = -1;
RightMenuCount: Integer = -1; RightMenuCount: Integer = -1;
MenuBarRLID: integer; MenuBarRLID: integer;
{$endif}
begin begin
{$ifndef Win32}
GetWindowRect(Wnd, BR); GetWindowRect(Wnd, BR);
mbi.hwndMB:=SHFindMenuBar(Wnd); mbi.hwndMB:=SHFindMenuBar(Wnd);
// if (mbi.hwndMB <> 0) and (CePlatform = cpSmartphone) then begin // if (mbi.hwndMB <> 0) and (CePlatform = cpSmartphone) then begin
@ -376,8 +376,8 @@ begin
end; end;
//DrawMenuBar(wnd); //DrawMenuBar(wnd);
{$endif}
end; end;
{$endif}
(* Returns index of the character in the menu item caption that is displayed (* Returns index of the character in the menu item caption that is displayed
as underlined and is therefore the hot key of the menu item. as underlined and is therefore the hot key of the menu item.