Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-06

Patch: Menuitem.Owner = nil -> invalid type cast(win32)

6 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner
to Micha Nelissen: Based on the assumption that the owner of a menuitem is a form, I recommend the following…
Show quoted text 8 lines
Hi, Based on the assumption that the owner of a menuitem is a form, I recommend the following patch. It now checks whether there is a valid pointer and this is of type tcustomform, which is what DrawMenuBar expects. If Michael thinks it's OK, please commit.

I have changed it to use teh Menu.Parent. Please test if it works. My cross compilation is not yet working. Lack of time. But I made some progress.

Mattias

Reply by email

Mattias Gaertner
to Micha Nelissen: Based on the assumption that the owner of a menuitem is a form, I recommend the following…
Show quoted text 13 lines
Micha Nelissen wrote: > Mattias Gaertner wrote: >> >> I have changed it to use teh Menu.Parent. Please test if it works. My >> cross compilation is not yet working. Lack of time. But I made some >> progress. > > IIRC, the Parent of a menu is another TMenuItem....This won't get us > very far. The parent of a tmenuitem is another tmenuitem. In delphi, a TMenu does not have a Parent. In the lcl it does, but I don't know what it represents. When is it set?

lcl/include/customform.inc TCustomForm.SetMenu

Mattias

Reply by email

Micha Nelissen
to Micha Nelissen: Based on the assumption that the owner of a menuitem is a form, I recommend the following…
Micha Nelissen wrote 8 lines
Mattias Gaertner wrote: > > I have changed it to use teh Menu.Parent. Please test if it works. My > cross compilation is not yet working. Lack of time. But I made some > progress. IIRC, the Parent of a menu is another TMenuItem....This won't get us very far.

The parent of a tmenuitem is another tmenuitem. In delphi, a TMenu does not have a Parent. In the lcl it does, but I don't know what it represents. When is it set?

Regards,

Micha.

Reply by email

Micha Nelissen
to Micha Nelissen: Based on the assumption that the owner of a menuitem is a form, I recommend the following…
Mattias Gaertner wrote 15 lines
On Thu, 26 Jun 2003 16:35:09 +0200 "Micha Nelissen" wrote: > Hi, > > Based on the assumption that the owner of a menuitem is a form, I > recommend the following patch. It now checks whether there is a valid > pointer and this is of type tcustomform, which is what DrawMenuBar > expects. > > If Michael thinks it's OK, please commit. I have changed it to use teh Menu.Parent. Please test if it works. My cross compilation is not yet working. Lack of time. But I made some progress.

IIRC, the Parent of a menu is another TMenuItem....This won't get us very far.

Regards,

Micha.

Reply by email

Micha Nelissen

Hi,

Based on the assumption that the owner of a menuitem is a form, I recommend the following patch. It now checks whether there is a valid pointer and this is of type tcustomform, which is what DrawMenuBar expects.

If Michael thinks it's OK, please commit.

Regards,

Micha.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bin00036.bin
Type: application/octet-stream
Size: 945 bytes
Desc: "menu_ownernil.patch"
Url : http://localhost/pipermail/lazarus/attachments/20030626/af229ff9/bin00036.bin

Reply by email

Micha Nelissen
to Micha Nelissen
Mattias Gaertner wrote 8 lines
On Thu, 26 Jun 2003 17:55:27 +0200 "Micha Nelissen" wrote: > The parent of a tmenuitem is another tmenuitem. In delphi, a TMenu > does not have a Parent. In the lcl it does, but I don't know what it > represents. When is it set? lcl/include/customform.inc TCustomForm.SetMenu

Ah ok, good thinking. It works correctly.

Regards,

Micha.

Reply by email