mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 09:16:15 +02:00
wince: reserve first 200 menu commands for the system use (by patch of haword, issue #0013192)
git-svn-id: trunk@18738 -
This commit is contained in:
parent
54d1e48d17
commit
675cfef7e7
@ -264,7 +264,7 @@ Var
|
||||
if PopupMenu <> nil then //processing popup menu
|
||||
begin
|
||||
WindowInfo^.PopupMenu := nil;
|
||||
Result := PopupMenu.FindItem(LOWORD(WParam), fkCommand);
|
||||
Result := PopupMenu.FindItem(LOWORD(WParam) - StartMenuItem , fkCommand);
|
||||
end;
|
||||
{$ifndef win32}
|
||||
if Result = nil then //if Result is still nil, process main menu
|
||||
@ -1130,15 +1130,23 @@ begin
|
||||
else
|
||||
begin
|
||||
{ Handles other reasons for WM_COMMAND }
|
||||
|
||||
if Hi(WParam) < 2 then //1 for accelerator 0 for menu
|
||||
TargetObject := GetMenuItemObject else // menuitem or shortcut
|
||||
begin
|
||||
TargetObject := GetMenuItemObject
|
||||
end
|
||||
else // menuitem or shortcut
|
||||
begin
|
||||
TargetObject := nil;
|
||||
end;
|
||||
|
||||
if TargetObject is TMenuItem then
|
||||
begin
|
||||
LMessage.Msg := LM_ACTIVATE;
|
||||
TargetObject.Dispatch(LMessage);
|
||||
lWinControl := nil;
|
||||
end else
|
||||
end
|
||||
else
|
||||
begin
|
||||
lWinControl := GetWindowInfo(LParam)^.WinControl;
|
||||
// buddy controls use 'awincontrol' to designate associated wincontrol
|
||||
@ -1687,6 +1695,7 @@ begin
|
||||
WM_NOTIFY:
|
||||
begin
|
||||
WindowInfo := GetWindowInfo(PNMHdr(LParam)^.hwndFrom);
|
||||
|
||||
{$ifdef MSG_DEBUG}
|
||||
DebugLn([MessageStackDepth, 'Notify code: ', PNMHdr(LParam)^.code]);
|
||||
{$endif}
|
||||
@ -2370,12 +2379,3 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -106,6 +106,9 @@ const
|
||||
|
||||
WM_LCL_SOCK_ASYNC = WM_USER;
|
||||
|
||||
StartMenuItem = 200;
|
||||
|
||||
|
||||
type
|
||||
|
||||
{ Policy for using the "OK" close button in the title instead of
|
||||
|
@ -85,7 +85,7 @@ const
|
||||
);
|
||||
MenuBarID_L = 40052;
|
||||
MenuBarID_R = 40053;
|
||||
|
||||
StartMenuItem = 200;
|
||||
var
|
||||
MenuItemsList : TStringList;
|
||||
|
||||
@ -175,7 +175,7 @@ begin
|
||||
fState:=fState or MF_GRAYED;
|
||||
if mi.fState and MFS_CHECKED <> 0 then
|
||||
fState:=fState or MF_CHECKED;
|
||||
uIDNewItem := mi.wID;
|
||||
uIDNewItem := mi.wID + StartMenuItem;
|
||||
if mi.hSubMenu <> 0 then
|
||||
begin
|
||||
uIDNewItem := mi.hSubMenu;
|
||||
@ -390,7 +390,7 @@ begin
|
||||
MenuInfo.cbSize := menuiteminfosize;
|
||||
MenuInfo.fMask := MIIM_TYPE;
|
||||
MenuInfo.dwTypeData := nil; // don't retrieve caption
|
||||
GetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command, false, @MenuInfo);
|
||||
GetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command + StartMenuItem, false, @MenuInfo);
|
||||
if Value then
|
||||
MenuInfo.fType := MenuInfo.fType or Flag
|
||||
else
|
||||
@ -401,7 +401,7 @@ begin
|
||||
{$else}
|
||||
MenuInfo.dwTypeData := PWideChar(wCaption);
|
||||
{$endif}
|
||||
Result := SetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command, false, @MenuInfo);
|
||||
Result := SetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command + StartMenuItem, false, @MenuInfo);
|
||||
TriggerFormUpdate(AMenuItem);
|
||||
end;
|
||||
|
||||
@ -435,7 +435,7 @@ begin
|
||||
fState := MFS_DISABLED;
|
||||
end;
|
||||
end;
|
||||
if not SetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command, false, @MenuInfo) then
|
||||
if not SetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command + StartMenuItem, false, @MenuInfo) then
|
||||
DebugLn('SetMenuItemInfo failed: ', GetLastErrorText(GetLastError));
|
||||
TriggerFormUpdate(AMenuItem);
|
||||
end;
|
||||
@ -462,7 +462,7 @@ begin
|
||||
cbSize := menuiteminfosize;
|
||||
fMask := MIIM_SUBMENU;
|
||||
end;
|
||||
GetMenuItemInfo(ParentOfParent, AMenuItem.Parent.Command,
|
||||
GetMenuItemInfo(ParentOfParent, AMenuItem.Parent.Command + StartMenuItem,
|
||||
False, @MenuInfo);
|
||||
if MenuInfo.hSubmenu = 0 then // the parent menu item is not yet defined with submenu flag
|
||||
begin
|
||||
@ -478,7 +478,7 @@ begin
|
||||
if AMenuItem.Checked then
|
||||
fState := fState or MF_CHECKED;
|
||||
|
||||
cmd := AMenuItem.Command; {value may only be 16 bit wide!}
|
||||
cmd := AMenuItem.Command + StartMenuItem; {value may only be 16 bit wide!}
|
||||
if (AMenuItem.Count > 0) then
|
||||
begin
|
||||
fState := fState or MF_POPUP;
|
||||
@ -501,11 +501,10 @@ begin
|
||||
//GetMenuItemInfo(ParentMenuHandle, Index, True, @MenuInfo);
|
||||
MenuInfo.dwItemData := PtrInt(AMenuItem);
|
||||
//MenuInfo.wID := AMenuItem.Command;
|
||||
|
||||
if not SetMenuItemInfoW(ParentMenuHandle, Index, True, @MenuInfo) then
|
||||
DebugLn(['SetMenuItemInfoW failed for ', dbgsName(AMenuItem), ' : ', GetLastErrorText(GetLastError)]);
|
||||
|
||||
MenuItemsList.AddObject(IntToStr(AMenuItem.Command), AMenuItem);
|
||||
MenuItemsList.AddObject(IntToStr(AMenuItem.Command + StartMenuItem), AMenuItem);
|
||||
TriggerFormUpdate(AMenuItem);
|
||||
end;
|
||||
|
||||
@ -517,7 +516,7 @@ end;
|
||||
class procedure TWinCEWSMenuItem.DestroyHandle(const AMenuItem: TMenuItem);
|
||||
begin
|
||||
if Assigned(AMenuItem.Parent) then
|
||||
DeleteMenu(AMenuItem.Parent.Handle, AMenuItem.Command, MF_BYCOMMAND);
|
||||
DeleteMenu(AMenuItem.Parent.Handle, AMenuItem.Command + StartMenuItem, MF_BYCOMMAND);
|
||||
DestroyMenu(AMenuItem.Handle);
|
||||
TriggerFormUpdate(AMenuItem);
|
||||
end;
|
||||
@ -536,7 +535,7 @@ begin
|
||||
uCheck := MF_CHECKED
|
||||
else
|
||||
uCheck := MF_UNCHECKED;
|
||||
Result := Boolean(Windows.CheckMenuItem(AMenuItem.Parent.Handle, AMenuItem.Command, uCheck));
|
||||
Result := Boolean(Windows.CheckMenuItem(AMenuItem.Parent.Handle, AMenuItem.Command + StartMenuItem, uCheck));
|
||||
end;
|
||||
|
||||
class procedure TWinCEWSMenuItem.SetShortCut(const AMenuItem: TMenuItem;
|
||||
@ -550,7 +549,7 @@ var
|
||||
EnableFlag: Integer;
|
||||
begin
|
||||
EnableFlag := MF_BYCOMMAND or EnabledToStateFlag[Enabled];
|
||||
Result := Boolean(Windows.EnableMenuItem(AMenuItem.Parent.Handle, AMenuItem.Command, EnableFlag));
|
||||
Result := Boolean(Windows.EnableMenuItem(AMenuItem.Parent.Handle, AMenuItem.Command + StartMenuItem, EnableFlag));
|
||||
TriggerFormUpdate(AMenuItem);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user