Board index » delphi » Inserting menu items in a POPUP menu

Inserting menu items in a POPUP menu

In Delphi 2:

The main menu component has methods to insert/delete items
from the main menu.
But the popup menu component does not have these methods.
Does anybody know why they don't?

I would like insert items into an already existant popup menu.
Has anybody seen any dynamic popup menu VCLs out there?
I'll use the win32 InsertMenuItem() if I have to.

Delphi 2 should have include the ability to do that... in my opinion.

Scott.
copu...@wku.edu

 

Re:Inserting menu items in a POPUP menu


And what if you would try:

NewMenuItem = menu item you want to add.

MyPopupMenu.Add(NewMenuItem)

or

MyPopopMenu.Items[0].Add(NewMenuItem);

This is what i wrote just before 5 minutes. As i have D4 running, I found
that
#1 doesnt work, and #2 adds a submenu to first item. The only work around
I can think off now is:

MyPopupMenu.Items[0].Parent.Add(NewMenuItem). This does work;)

Quote
Scott Copus wrote:
> In Delphi 2:

> The main menu component has methods to insert/delete items
> from the main menu.
> But the popup menu component does not have these methods.
> Does anybody know why they don't?

> I would like insert items into an already existant popup menu.
> Has anybody seen any dynamic popup menu VCLs out there?
> I'll use the win32 InsertMenuItem() if I have to.

> Delphi 2 should have include the ability to do that... in my opinion.

> Scott.
> copu...@wku.edu

--
|? Algirdas 'Ze{*word*104}' Kepezinskas
|? E-Mail: cy...@vil.ktu.lt
|? ICQ 14187537
|? URL: http://www.botepidemic.com/fmods
+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*++*+*+*+*
|? If time is killing you
|?????????????????? kill some for time..
?

Re:Inserting menu items in a POPUP menu


Quote
In article <36D3166F.1C2C...@wku.edu>, Scott Copus <copu...@wku.edu> writes:
>The main menu component has methods to insert/delete items
>from the main menu.
>But the popup menu component does not have these methods.
>Does anybody know why they don't?

>I would like insert items into an already existant popup menu.
>Has anybody seen any dynamic popup menu VCLs out there?
>I'll use the win32 InsertMenuItem() if I have to.

The TPopUpMenu is like a TMenuItem which has an Items property holding all the
menu items you see (when you right-click) as TMenuItems. So code like :-

var
  MI : TMenuItem;
begin
  MI := TMenuItem.Create(Self);
  MI.Caption := 'New Item';
  MI.OnClick := MyOnClick;
  Mi.Checked := true;
{etc etc}
  PopUpMenu1.Items.Add(MI);  // or  PopUpMenu1.Items.Insert(1, MI);
end;

Alan Lloyd
alangll...@aol.com

Re:Inserting menu items in a POPUP menu


Yeah.. were not.. i tryied jump over myself again;)

Quote
AlanGLLoyd wrote:
> In article <36D3166F.1C2C...@wku.edu>, Scott Copus <copu...@wku.edu> writes:

> >The main menu component has methods to insert/delete items
> >from the main menu.
> >But the popup menu component does not have these methods.
> >Does anybody know why they don't?

> >I would like insert items into an already existant popup menu.
> >Has anybody seen any dynamic popup menu VCLs out there?
> >I'll use the win32 InsertMenuItem() if I have to.

> The TPopUpMenu is like a TMenuItem which has an Items property holding all the
> menu items you see (when you right-click) as TMenuItems. So code like :-

> var
> ? MI : TMenuItem;
> begin
> ? MI := TMenuItem.Create(Self);
> ? MI.Caption := 'New Item';
> ? MI.OnClick := MyOnClick;
> ? Mi.Checked := true;
> {etc etc}
> ? PopUpMenu1.Items.Add(MI);? // or? PopUpMenu1.Items.Insert(1, MI);
> end;

> Alan Lloyd
> alangll...@aol.com

--
|? Algirdas 'Ze{*word*104}' Kepezinskas
|? E-Mail: cy...@vil.ktu.lt
|? ICQ 14187537
|? URL: http://www.botepidemic.com/fmods
+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*++*+*+*+*
|? If time is killing you
|?????????????????? kill some for time..
?

Other Threads