mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 19:35:57 +02:00
applied menu fix from Micha Nelissen
git-svn-id: trunk@4301 -
This commit is contained in:
parent
d98a5ac0ca
commit
6bb58b5c11
@ -227,15 +227,15 @@ Procedure TWin32Object.SetLabel(Sender: TObject; Data: Pointer);
|
||||
cbsize:=sizeof(MENUITEMINFO);
|
||||
{In Win32 Menu items that are created without a initial caption default to disabled,
|
||||
the next three lines are to counter that.}
|
||||
fMask:=MIIM_STATE;
|
||||
GetMenuItemInfo((Sender as TMenuItem).Parent.Handle, integer((Sender as TMenuItem).Handle), false, @MenuInfo);
|
||||
fMask:=MIIM_STATE or MIIM_TYPE or MIIM_ID;
|
||||
GetMenuItemInfo((Sender as TMenuItem).Parent.Handle, integer((Sender as TMenuItem).Handle) and $FFFF, false, @MenuInfo);
|
||||
if (Sender as TMenuItem).Enabled then fState := fState and (not (MFS_DISABLED or MFS_GRAYED));
|
||||
|
||||
fMask:=MIIM_TYPE or MIIM_STATE;
|
||||
fType:=Style;
|
||||
dwTypeData:=Data;
|
||||
end;
|
||||
SetMenuItemInfo((Sender as TMenuItem).Parent.Handle, integer((Sender as TMenuItem).Handle), false, @MenuInfo);
|
||||
SetMenuItemInfo((Sender as TMenuItem).Parent.Handle, integer((Sender as TMenuItem).Handle) and $FFFF, false, @MenuInfo);
|
||||
DrawMenuBar(((Sender as TMenuItem).Owner as TWinControl).Handle);
|
||||
End;
|
||||
|
||||
@ -2591,11 +2591,11 @@ Begin
|
||||
cbSize:=sizeof(MENUITEMINFO);
|
||||
fMask:=MIIM_SUBMENU;
|
||||
end;
|
||||
GetMenuItemInfo(ParentOfParent, ParentMenuHandle, false, @MenuInfo);
|
||||
GetMenuItemInfo(ParentOfParent, (ParentMenuHandle) and $FFFF, false, @MenuInfo);
|
||||
if MenuInfo.hSubmenu=0 then // the parent menu item is not yet defined with submenu flag
|
||||
begin
|
||||
MenuInfo.hSubmenu:=ParentMenuHandle;
|
||||
SetMenuItemInfo(ParentOfParent, ParentMenuHandle, false, MenuInfo);
|
||||
SetMenuItemInfo(ParentOfParent, Integer(ParentMenuHandle) and $FFFF, false, MenuInfo);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2607,7 +2607,7 @@ Begin
|
||||
fMask:=Mask;
|
||||
fType:=Style;
|
||||
{fState:=MFS_ENABLED;} {not needed}
|
||||
wID:=integer(MenuHandle);
|
||||
wID:=integer(MenuHandle) and $FFFF; {value is only 16 bit wide!}
|
||||
hSubmenu:=MenuHandle;
|
||||
{hbmpChecked:=0;
|
||||
hbmpUnchecked:=0;} {not needed}
|
||||
@ -2615,7 +2615,7 @@ Begin
|
||||
{dwTypeData:=LPSTR((Sender as TmenuItem).Caption);}
|
||||
{cch:=length((Sender as TMenuItem).Caption);} {not needed}
|
||||
end;
|
||||
InsertMenuItem(ParentMenuHandle, 0, false, @MenuInfo);
|
||||
InsertMenuItem(ParentMenuHandle, -1, true, @MenuInfo);
|
||||
if (Sender as TMenuItem).ShortCut <> 0 then
|
||||
begin
|
||||
Msg.Handle:=MenuHandle;
|
||||
@ -2659,6 +2659,9 @@ End;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.52 2003/06/24 08:32:03 mattias
|
||||
applied menu fix from Micha Nelissen
|
||||
|
||||
Revision 1.51 2003/03/25 08:12:39 mattias
|
||||
patch from Martin Smat for menu items and default messages
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user