How to customize pull down menu?

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

Add the following codes (change to your needs) into 'hmcustom.tcl' :


set mypath 'C:/Users/MYNAME/myscripts';

set top_menu [hm_framework getpulldowns]
catch {$top_menu delete [.hmMainMenuBar index 'MyMenu']}
catch {destroy $top_menu.custom}

menu $top_menu.custom -tearoff 0
$top_menu insert 20 cascade -label 'MyMenu' -menu $top_menu.custom

set cat1 $top_menu.custom
$cat1 add cascade -label 'Category 1' -underline 0 -menu [menu $cat1.mnu1 -title 'Cat-1']
$cat1.mnu1 add command -label 'Script 1' -command 'source {$mypath/script1.tcl}' -underline 0
$cat1.mnu1 add command -label 'Script 2' -command 'source {$mypath/script2.tcl}' -underline 0

$top_menu.custom add separator

set cat2 $top_menu.custom
$cat2 add cascade -label 'Category 2' -underline 0 -menu [menu $cat2.mnu2 -title 'Cat-2']
$cat2.mnu2 add command -label 'Script 21' -command 'source {$mypath/script21.tcl}' -underline 0
$cat2.mnu2 add command -label 'Script 22' -command 'source {$mypath/script22.tcl}' -underline 0

Start HM and you get your customized menus, see screenshot.

<?xml version="1.0" encoding="UTF-8"?>post-889-0-32501700-1416994162_thumb.png

Find more posts tagged with