cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

adding custom menu and submenu items

ptc-1123085
1-Newbie

adding custom menu and submenu items

Hello. I am trying to add submenu items to the Edit menu. I figured out how to add the items to Edit, but what I really want to do is to create an Edit menu item 'Block Selection' that has 3 submenu options (like Tools > Compare).

Here is a snippet of my existing code:

if( !menu_exists(".Edit.Block Selection") ) {
menu_add -before ".Edit.Delete Markup" "Block Selection &Start" -cmd {tigre::selectionStartSave();} -keytext "Alt+.";
menu_add -before ".Edit.Delete Markup" "Block Selection &End" -cmd {tigre::selectionStartSave();} -keytext "Alt+>";
menu_add -before ".Edit.Delete Markup" "Block Selection &Mark" -cmd {tigre::selectionStartSave();} -keytext "Alt+=";
menu_add -before ".Edit.Delete Markup" " -separator;
}

If you know the magic words to create submenus, please help! Thanks.

- karen dL.

6 REPLIES 6

function add_tools_create_change_bar_markup(){
###########################################
#Tools Create Change Bar Markup
###########################################
if(!menu_exists(".Tools.Create Change Bar Markup")) {
menu_add -menu -before .Tools.Spelling "&Create Change Bar
Markup"
}
}

The code above creates "Create Change Bar Markup" which is really a
sub-menu.

Hi Karen-



You want to use menu_add -menu to create your submenu, then add your
commands to that submenu. Something like this:



menu_add -menu -before ".Edit.Delete_Markup" "My submenu"

menu_add ".Edit.My_submenu." "Block Selection &Start" -cmd
{tigre::selectionStartSave();} -keytext "Alt+."

...etc.



HTH



--Clay



Clay Helberg

Senior Consultant

TerraXML


Thank you both for your help, but I still am not seeing what I want to see.

whatI want is:

Edit > Block Selection > (Start | End | Mark)

what I get is:

Edit > (Start | End | Mark)

Currently, my code looks like this:

if( !menu_exists(".Edit.Block Selection") ) {

menu_add -menu -before ".Edit.Delete Markup" 'Block Selection';
menu_add ".Edit.Block_Selection" "&Start" -cmd {tigre::selectionStartSave();} -keytext "Alt+.";
menu_add ".Edit.Block_Selection" "&End" -cmd {tigre::selectionEndSave();} -keytext "Alt+>";
menu_add ".Edit.Block_Selection" "&Mark" -cmd {tigre::selectionMarkIt();} -keytext "Alt+=";
menu_add -before ".Edit.Delete Markup" " -separator;
}

Thank you both for your help, but I still am not seeing what I want to see.

whatI want is:

Edit > Block Selection > (Start | End | Mark)

what I get is:

Edit > (Start | End | Mark)

Currently, my code looks like this:

if( !menu_exists(".Edit.Block Selection") ) {

menu_add -menu -before ".Edit.Delete Markup" 'Block Selection';
menu_add ".Edit.Block_Selection" "&Start" -cmd {tigre::selectionStartSave();} -keytext "Alt+.";
menu_add ".Edit.Block_Selection" "&End" -cmd {tigre::selectionEndSave();} -keytext "Alt+>";
menu_add ".Edit.Block_Selection" "&Mark" -cmd {tigre::selectionMarkIt();} -keytext "Alt+=";
menu_add -before ".Edit.Delete Markup" " -separator;
}

Hi Karen-



The piece you're missing is a dot at the end of each of your menu paths in
your menu_add commands. So, your code should look like this:



if( !menu_exists(".Edit.Block Selection") ) {

menu_add -menu -before ".Edit.Delete Markup" 'Block Selection';

menu_add ".Edit.Block_Selection." "&Start" -cmd
{tigre::selectionStartSave();} -keytext "Alt+.";

menu_add ".Edit.Block_Selection." "&End" -cmd
{tigre::selectionEndSave();} -keytext "Alt+>";

menu_add ".Edit.Block_Selection." "&Mark" -cmd
{tigre::selectionMarkIt();} -keytext "Alt+=";

menu_add -before ".Edit.Delete Markup" " -separator;

}



You have to look carefully to see it, but I've changed
".Edit.Block_Selection" to ".Edit.Block_Selection."



--Clay



Clay Helberg

Senior Consultant

TerraXML


Yay! Thank you. It works now. Whew.

- kdL.

Announcements