Article View: comp.lang.pascal.delphi.misc
Article #66Re: How to dynamically add a menuitem in run-time ?
From: Chow Hoi Ka, Eric
Date: Sat, 17 Apr 1999 00:00
Date: Sat, 17 Apr 1999 00:00
84 lines
4113 bytes
4113 bytes
Hello,
Thanks for you reply and teach.
But, would you please to tell me how to define "Holder.ClickHandler" ???
Or, would you please to give me a full example ??
Best regards,
Eric
Niklas Lagergren wrote:
> This is a procedure that I ripped from on of my programs that does it:
>
> procedure InitPlugin(ParentMenu: TMainMenu);
> var
> i: TMenuItem;
>
> begin
> // Create new menu item
> i := NewItem('Plugin &1', // Caption
> scNone, // Shortcut
> False, // Checkmark
> True, // Enabled
> Holder.ClickHandler, // Event handler
> 0, // Help context ID
> 'Plugin_1'); // Name
> ParentMenu.Items[0].Add(i);
> end;
>
> Lookup NewItem in the help if you don't understand it...
>
> Regards,
> Lani
>
> "Chow Hoi Ka, Eric" skrev:
>
> > Hello,
> >
> > How to dynamically add a menuitem in run-time ?
> > And if it is possible, how to dynamically add the action-event(Click)
> > for it ?
> >
> > For example,
> > The following is the Menu structure :
> >
> > [Edit]
> > Undo
> > Cut
> > other_Menu_Item
> >
> > My main question is that how can I dynamically add the other_menu_item
> > in thge Edit menu in run-time and with the Click Event?
> > If I don't know how many "other_Menu_Item" will be added in the design
> > time, how to implement this with Click Event?
> >
> > Would you please to give me a simple example about this ????
> >
> > Best regards,
> > Eric
> >
> > --
> > _ _
> > / ) |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ( \
> > / / | | \ \
> > _( /_ | _ Chow Hoi Ka, Eric _ | _) )_
> > (((\ \> |/ ) ( \| </ /)))
> > (\\\\ \_/ / E-Mail : d951686@sftw.umac.mo \ \_/ ////)
> > \ / \ /
> > \ _/ http://www.sftw.umac.mo/~d951686/ \_ /
> > / / |____________________________________________| \ \
> > / / \ \
--
_ _
/ ) |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ( \
/ / | | \ \
_( /_ | _ Chow Hoi Ka, Eric _ | _) )_
(((\ \> |/ ) ( \| </ /)))
(\\\\ \_/ / E-Mail : d951686@sftw.umac.mo \ \_/ ////)
\ / \ /
\ _/ http://www.sftw.umac.mo/~d951686/ \_ /
/ / |____________________________________________| \ \
/ / \ \
Technical Details
Message-ID:
<3718890C.FFA01D8E@sftw.umac.mo>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<371863FB.28DA658E@sftw.umac.mo> <371864A7.14CD5263@swipnet.se>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fd817,8c4b696a74ad7796 X-Google-Attributes: gidfd817,public X-Google-Thread: 1043cf,8c4b696a74ad7796 X-Google-Attributes: gid1043cf,public X-Google-Thread: 115d96,8c4b696a74ad7796 X-Google-Attributes: gid115d96,public X-Google-Thread: 10baee,8c4b696a74ad7796 X-Google-Attributes: gid10baee,public From: "Chow Hoi Ka, Eric" <d951686@sftw.umac.mo> Subject: Re: How to dynamically add a menuitem in run-time ? Date: 1999/04/17 Message-ID: <3718890C.FFA01D8E@sftw.umac.mo> X-Deja-AN: 467632118 Content-Transfer-Encoding: 7bit References: <371863FB.28DA658E@sftw.umac.mo> <371864A7.14CD5263@swipnet.se> To: Niklas Lagergren <lani@swipnet.se> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: news@umacss2.umac.mo X-Trace: umacss2.umac.mo 924353879 3621 161.64.3.185 (17 Apr 1999 12:57:59 GMT) Organization: University of Macau Mime-Version: 1.0 Reply-To: d951686@sftw.umac.mo NNTP-Posting-Date: 17 Apr 1999 12:57:59 GMT Newsgroups: comp.lang.pascal.delphi.misc,alt.comp.lang.borland-delphi,borland.public.delphi.database,borland.public.delphi.objectpascal