Graphics.AddingMenuItems - lordmundi/wikidoctest GitHub Wiki

Adding Menu Items

« Timeouts On DCOMM Initialization Of Connection | EDGE User’s Guide | Using the FOV overlay »

Adding an item to the Options menu

Menu addition
Addition to the "Options" menu

The following tcl code will add an entry into the Options menu of EDGE:

proc add_stuff_to_blipper_menu { command_to_run } {
     set dougmain     [doug.display get -main_window]
     set blipper_menu ${dougmain}.menu.generic

     # Add cascade menu for combined simulation items
     menu ${blipper_menu}.mymenu -tearoff 0
     ${blipper_menu} add command -label "My Menu Entry" \
         -command "${command_to_run}"
 }

 set my_command "puts \"Wuzzzzzzaaahhhh\""
 doug.callback add timer -delay 0.5 -autoreset 0 {add_stuff_to_blipper_menu $my_command}

Adding an item to the right-click menu

Menu addition
Addition to the right-click menu

The following tcl code will add some entries into the right click menu of EDGE:

global dougmain.popup

 set dougmain    [doug.display get -main_window]
 set original_br1_binding [bind ${dougmain} <ButtonRelease-1>]

 proc setup_right_click_menu { } {
     global dougmain

     set menu_instance "myMenu"
     menu ${dougmain}.popup.${menu_instance} -tearoff 0

     ${dougmain}.popup insert 0 cascade \
         -label "My Menu Label" -menu ${dougmain}.popup.${menu_instance}

     ${dougmain}.popup.${menu_instance} add command -label "My Menu Option 1" \
         -command "puts \"Selection option1!!!\""

     ${dougmain}.popup.${menu_instance} add command -label "My Menu Option 2" \
         -command "puts \"Selection option2!!!\""
 }

 setup_right_click_menu

« Timeouts On DCOMM Initialization Of Connection | EDGE User’s Guide | Using the FOV overlay »