[lazarus] Win32 menu does not work

Micha Nelissen mdvpost at hotmail.com
Tue Jun 24 12:35:07 EDT 2003


Mattias Gaertner wrote:
> On Tue, 24 Jun 2003 17:40:07 +0200
> "Micha Nelissen" <mdvpost at hotmail.com> wrote:
>
>> Micha Nelissen wrote:
>>> Mattias Gaertner wrote:
>>>> On Tue, 24 Jun 2003 11:53:25 +0200
>>>> "Micha Nelissen" <mdvpost at hotmail.com> wrote:
>>>>
>>>>>> TBits is implemented, so you can try it.
>>>>
>>>> Please do so.
>>>>
>>>
>>> to see if the TBits are functioning well. We can also try checking
>>> whether disabling/enabling checking/unchecking works as expected,
>>> ie. not call the handler when disabled.
>>
>> And another patch to fix the check/enable issue. Like the other
>> patch: apply in lcl/interfaces/win32.
>
> Applied.
>
> I have added the public property Command: integer; to TMenuItem. The
> FCommand ist set just like Delphi on creation and destruction.
> I replaced the FCommand in the win32 intf by Command. Please check if
> this is correct. (I have to find out, how this cross compiling works
> ...)

I think you have deleted some by accident; you still need to apply:

@@ -537,6 +534,7 @@
           Begin
             DeleteMenu((Sender as TMenuItem).Parent.Handle, Handle,
MF_BYCOMMAND);
             { release menu item id }
+            MenuItemIdPool.Bits[(Sender as TMenuItem).Command] := False;
             DrawMenuBar(((Sender as TMenuItem).Owner as
TWinControl).Handle);
           End
           Else
@@ -2614,6 +2610,8 @@
     fMask:=Mask;
     fType:=Style;
     {fState:=MFS_ENABLED;} {not needed}
+    wID:=UniqueMenuItemId; {value may only be 16 bit wide!}
+    (Sender as TMenuItem).Command := wID;
     hSubmenu:=MenuHandle;
     {hbmpChecked:=0;
     hbmpUnchecked:=0;} {not needed}
---end patch---

Regards,

Micha.






More information about the Lazarus mailing list