Jump to content
Guest

How to customize pull down menu?

Recommended Posts

Guest

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.


post-889-0-32501700-1416994162_thumb.png

Iron_Man59 likes this

Share this post


Link to post
Share on other sites

Hello,


 


First of all, great job, this topic is really useful! 


I just have one question. How do I create a second level of cascade? I want that after "Category 1" a new cascade appears with "Category 1_1" and "Category 1_2" and then I'll place my macros on those menus.


 


Regards,


 


Lawrence


Share this post


Link to post
Share on other sites

Hello,

 

First of all, great job, this topic is really useful! 

I just have one question. How do I create a second level of cascade? I want that after "Category 1" a new cascade appears with "Category 1_1" and "Category 1_2" and then I'll place my macros on those menus.

 

Regards,

 

Lawrence

Hi

you can make sub-menu by pathname add cascade

http://www.tcl.tk/man/tcl8.5/TkCmd/menu.htm#M26

ngoc.tam likes this

Share this post


Link to post
Share on other sites

I can not file location's hmcustom.tcl , Is this the same hmsettings.tcl and same location. When i add the codes, i can not see the new Menu also, But when i run the new codes. Its ok. But i can not use the sub-menu. and This sub-menu can use normally if i call direct

 

 

2016-03-24_14-44-44.png

Share this post


Link to post
Share on other sites

Hello,

 

thanks a lot for the topic, it's very useful! It works great the first time I open HM.

 

However, I have a problem when I change the user profile (Preferences->User Profiles). If I change the profile, my menu disappears.

I understood that, changing the profile, all the menus are reloaded and the hmcustom.tcl is loaded only the first time, but I didn't found a workaround to reload my menu.

 

Thanks for any reply.

Regards

Share this post


Link to post
Share on other sites
21 hours ago, Jack LC said:

Hello,

 

thanks a lot for the topic, it's very useful! It works great the first time I open HM.

 

However, I have a problem when I change the user profile (Preferences->User Profiles). If I change the profile, my menu disappears.

I understood that, changing the profile, all the menus are reloaded and the hmcustom.tcl is loaded only the first time, but I didn't found a workaround to reload my menu.

 

Thanks for any reply.

Regards

 

B)

Hi,

to reload hmcustom.tcl after userprofile changed, add below code to hmcustom.tcl:


 

set ::hmcustomtclpath [info script]
proc ::reloadhmcustomtcl args {
     source $::hmcustomtclpath
}
if {[lsearch -exact [hm_framework getregisteredprocs after_userprofile] ::reloadhmcustomtcl]!=-1} {
    hm_framework registerproc ::reloadhmcustomtcl after_userprofile
}

 

 

Pandurang and Jack LC like this

Share this post


Link to post
Share on other sites

Hi tinh,

 

thanks, I appreciate a lot your valuable and fast reply.

 

Your code works fine, I had just to replace !=1 with ==1 in the if condition.

 

Thanks again!

Regards

tinh likes this

Share this post


Link to post
Share on other sites
On 11/26/2014 at 3:02 PM, Guest said:

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.

 

 

post-889-0-32501700-1416994162_thumb.png

 

hello,

 i am new to this forum. please can you tell me how to use this option?

 

thank you ,

Share this post


Link to post
Share on other sites

I have run this script the option (my menu) is opening in hm but the script is not taking from 

set mypath "E:/vedio/scripts";

and when I press the category 1. -tria per node.tcl it shows error (no such file or directory) like already showed in image.

2016-03-24_14-44-44.png.d141f20a9e46e317b69ce71592747521.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...