[lazarus] patch for setmenu

Micha Nelissen micha at neli.hopto.org
Thu Dec 18 02:51:23 EST 2003


Marc Weustink wrote:

> At 23:52 17-12-2003, Darek Mazur wrote:
> 
>> Hi
>>
>> When I was testing SETMENU I found a bug: I have changed MAINMENU many 
>> times
>> (choice from 3 MENUS) and MAINMENU has been changed only one for each 
>> first
>> set MENU,  second time was no change. (sorry for my english)
>>
>> my patch for this:
>> inCUSTOMFORM.INC
>> Procedure TCustomForm.SetMenu(Value : TMainMenu);
>>
>>
>>
>>   FMenu := Value;
>>   if FMenu<>nil then begin
>>     FMenu.Parent:=Self;
>>     if HandleAllocated and (not (csLoading in ComponentState)) then begin
>>       FMenu.HandleNeeded;
>>       AttachMenuToWindow(FMENU);  // <--- this added
>>     end;
>>   end;
> 
> 
> 
> Shouldn't be needed there. Isn't this something for the interface ?

It is needed. If menus have been created, then there is no call to the 
interface anymore.

Patch applied. Thanks,

Micha.






More information about the Lazarus mailing list