BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

dynamically Add Items to a PopupMenu

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++)
View previous topic :: View next topic  
Author Message
Ramy
Guest





PostPosted: Tue May 31, 2005 10:18 am    Post subject: Re: dynamically Add Items to a PopupMenu Reply with quote





TForm1 *Form1;
TMainMenu *MainMenu;
TMenuItem *Item1, *Item2, *Item3, *Item4, *Item5, *Item6;

MainMenu = new TMainMenu( YourForm );

Item1 = new TMenuItem( MainMenu );
Item2 = new TMenuItem( MainMenu );
Item3 = new TMenuItem( MainMenu );
Item4 = new TMenuItem( MainMenu );
Item5 = new TMenuItem( MainMenu );
Item6 = new TMenuItem( MainMenu );

Item1->Caption = "File";
Item2->Caption = "Open...";
Item3->Caption = "Save...";
Item4->Caption = "Port";
Item5->Caption = "COM1";
Item6->Caption = "COM2";

MainMenu->Items->Add( Item1 );
Item1->Add( Item2 );
Item1->Add( Item3 );
Item1->Add( Item4 );

Item4->Add( Item5 );
Item4->Add( Item6 );

Form1->Menu = MainMenu;


"Grety" <valid (AT) emailaddress (DOT) com> wrote:
Quote:
hi
how could I dynamically Add Items to a PopupMenu?


Back to top
Rudy Velthuis [TeamB]
Guest





PostPosted: Tue May 31, 2005 11:33 am    Post subject: Re: dynamically Add Items to a PopupMenu Reply with quote



At 11:43:37, 01.06.2005, Grety wrote:

Quote:
hi
how could I dynamically Add Items to a PopupMenu?

MyItem = NewItem("Menu item text", 0, false, true, MyItemClick,
0, "MyItem");
MyMenu->InsertComponent(MyItem);
MyMenu->Insert(InsertPosition, MyItem);

for a separator line, you can use NewLine() instead of NewItem().
--
Rudy Velthuis [TeamB] http://velthuis.homepage.t-online.de

"I have often regretted my speech, never my silence."
- Xenocrates (396-314 B.C.)

Back to top
Ron Sawyer
Guest





PostPosted: Tue May 31, 2005 5:59 pm    Post subject: Re: dynamically Add Items to a PopupMenu Reply with quote



Others have answered the how's - let me chime in with the when. The popup
menu has an OnPopup event that is called just before pop-up menu appears.

"Grety" <valid (AT) emailaddress (DOT) com> wrote

Quote:
hi
how could I dynamically Add Items to a PopupMenu?





Back to top
Grety
Guest





PostPosted: Wed Jun 01, 2005 9:43 am    Post subject: dynamically Add Items to a PopupMenu Reply with quote

hi
how could I dynamically Add Items to a PopupMenu?


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.