[lazarus] LCL: menu creation order
Mattias Gaertner
nc-gaertnma at netcologne.de
Tue Jul 1 05:09:34 EDT 2003
On Tue, 1 Jul 2003 10:08:38 +0200
"Micha Nelissen" <mdvpost at hotmail.com> wrote:
> 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?
Bottom-Up or Top-Down are both logical and should be supported by the
interfaces. But for readability and debugging I changed it.
> 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.
What do you need to fix that?
> Ultimate reason: the win32 interface seems to crash when a shortcut is set
> for a particular menuitem. It occurs when running the lazarus ide.
I'm sure you will find the bug.
Apropos IDE: Did you try the TSynEdit under win32?
Mattias
More information about the Lazarus
mailing list