🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.pascal.delphi.misc
3 messages
3 total messages Started by Chow Hoi Ka, Eric Sat, 17 Apr 1999 00:00
How to dynamically add a menuitem in run-time ?
#64
Author: Chow Hoi Ka, Eric
Date: Sat, 17 Apr 1999 00:00
38 lines
2278 bytes
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/      \_     /
  /   / |____________________________________________| \    \
 /   /                                                   \    \
Re: How to dynamically add a menuitem in run-time ?
#65
Author: Niklas Lagergren
Date: Sat, 17 Apr 1999 00:00
60 lines
3049 bytes
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/      \_     /
>   /   / |____________________________________________| \    \
>  /   /                                                   \    \
Re: How to dynamically add a menuitem in run-time ?
#66
Author: Chow Hoi Ka, Eric
Date: Sat, 17 Apr 1999 00:00
84 lines
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/      \_     /
  /   / |____________________________________________| \    \
 /   /                                                   \    \
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads