JackM
2008-09-03 17:26:55 UTC
Question:
How do I access an "OnClick" event handler for a dynamically create
menu option?
I have a TMenuItem "Display1" and have dynamically added subMenu items
"Victory x, Victory y, and Victory z" as submenu items under Display1.
Where do I find the event handler "OnClick" to use when the user
clicks one of the submenu items?
//////////////////////////////////////////////////////////////////////////////////////////////
//This part of the code is working:
//to dynamically add submenu items
//Victory x, Victory x, and Victory z, to "Display1":
// step one
// "Display1" was declared earlier using the Tools pallet and Object
inspector
// the declaration of "Display1" looks like this --> TMenuItem
*Display1;
// step two
TMenuItem *Itemx = new TMenuItem( Display1 );
TMenuItem *Itemy = new TMenuItem( Display1 );
TMenuItem *Itemz = new TMenuItem( Display1 );
// step three
Itemx->Caption="Victory x";
Itemy->Caption="Victory y";
Itemz->Caption="Victory z";
// step four
// included for clarity but not needed because Display1 is part of
MainMenu.
// MainMenu is declared as TMainMenu *MainMenu1;
// step five
// menu items added under menu item Display1 as subMenu items
Display1->Add(Itemx);
Display1->Add(Itemy);
Display1->Add(Itemz);
/////////////////////////////////////////////////////////////////////////////////////////
I greatly appreciate any hints.
Thank you,
Jack McDaniel 760 438 9255
How do I access an "OnClick" event handler for a dynamically create
menu option?
I have a TMenuItem "Display1" and have dynamically added subMenu items
"Victory x, Victory y, and Victory z" as submenu items under Display1.
Where do I find the event handler "OnClick" to use when the user
clicks one of the submenu items?
//////////////////////////////////////////////////////////////////////////////////////////////
//This part of the code is working:
//to dynamically add submenu items
//Victory x, Victory x, and Victory z, to "Display1":
// step one
// "Display1" was declared earlier using the Tools pallet and Object
inspector
// the declaration of "Display1" looks like this --> TMenuItem
*Display1;
// step two
TMenuItem *Itemx = new TMenuItem( Display1 );
TMenuItem *Itemy = new TMenuItem( Display1 );
TMenuItem *Itemz = new TMenuItem( Display1 );
// step three
Itemx->Caption="Victory x";
Itemy->Caption="Victory y";
Itemz->Caption="Victory z";
// step four
// included for clarity but not needed because Display1 is part of
MainMenu.
// MainMenu is declared as TMainMenu *MainMenu1;
// step five
// menu items added under menu item Display1 as subMenu items
Display1->Add(Itemx);
Display1->Add(Itemy);
Display1->Add(Itemz);
/////////////////////////////////////////////////////////////////////////////////////////
I greatly appreciate any hints.
Thank you,
Jack McDaniel 760 438 9255