[lazarus] LCL: menu creation order
Micha Nelissen
mdvpost at hotmail.com
Tue Jul 1 03:42:03 EDT 2003
Hi,
Currently, TMenuItem.CreateHandle looks like this:
---
SendMsgToInterface(LM_CREATE, Self, nil);
if FItems<>nil then begin
for i := 0 to Count - 1 do begin
Items[i].HandleNeeded;
end;
end;
if Parent <> nil then
begin
Parent.HandleNeeded;
if Parent.HandleAllocated then
SendMsgToInterface(LM_ATTACHMENU, Self, nil);
if HandleAllocated then begin
if ShortCut <> 0 then ShortCutChanged(0, Shortcut);
end;
end;
---
It first creates the children, then attaches to parent. Wouldn't it be more
logical to do it the other way around? First check/attach parent, then
create children? I am asking this because win32object.attachmenu uses the
parent of the parent and I am not sure whether it is initialized at all
times, ie. the children are attached to parents.
Ultimate reason: the win32 interface seems to crash when a shortcut is set
for a particular menuitem. It occurs when running the lazarus ide.
Thanks,
Micha.
More information about the Lazarus
mailing list