How to expand the tab area using code
Best Answer
-
Hi,
I remember that I answered a similar somewhere, but I can't find the post!
you can invoke the menu:
in Hypermesh:
[. cget -menu].view.tab_area invoke "Right"
But if you use Hypermesh Desktop, menu widgets (and others) seem to be dynamically generated!
so we need to detect them, example proc:
proc callMainPulldown args { set mnuMain [. cget -menu] set mnuName $mnuMain set found [lrepeat [llength $args] 0] set cur 0 foreach inputText $args { set itemCount [$mnuName index end] for {set i 0} {$i <= $itemCount} {incr i} { if {[string equal "separator" [$mnuName type $i]]} continue set mnuText [$mnuName entrycget $i -label] if {[string equal -nocase $inputText $mnuText]} { lset found $cur 1 lset args $cur $mnuText if {[string equal "cascade" [$mnuName type $i]]} { set mnuName [$mnuName entrycget $i -menu] break } } } incr cur } set idx [lsearch -exact $found 0] if {$idx != -1} {return -code error "Error in callMainPulldown: Not found menu item '[lindex $args $idx]'"} $mnuName invoke [lindex $args end] } # usage: callMainPulldown View "Tab Area" Right # you can call other things: callMainPulldown xyplots create curves "single curve"
1
Answers
-
Hi,
I remember that I answered a similar somewhere, but I can't find the post!
you can invoke the menu:
in Hypermesh:
[. cget -menu].view.tab_area invoke "Right"
But if you use Hypermesh Desktop, menu widgets (and others) seem to be dynamically generated!
so we need to detect them, example proc:
proc callMainPulldown args { set mnuMain [. cget -menu] set mnuName $mnuMain set found [lrepeat [llength $args] 0] set cur 0 foreach inputText $args { set itemCount [$mnuName index end] for {set i 0} {$i <= $itemCount} {incr i} { if {[string equal "separator" [$mnuName type $i]]} continue set mnuText [$mnuName entrycget $i -label] if {[string equal -nocase $inputText $mnuText]} { lset found $cur 1 lset args $cur $mnuText if {[string equal "cascade" [$mnuName type $i]]} { set mnuName [$mnuName entrycget $i -menu] break } } } incr cur } set idx [lsearch -exact $found 0] if {$idx != -1} {return -code error "Error in callMainPulldown: Not found menu item '[lindex $args $idx]'"} $mnuName invoke [lindex $args end] } # usage: callMainPulldown View "Tab Area" Right # you can call other things: callMainPulldown xyplots create curves "single curve"
1 -
tinh said:
Hi,
I remember that I answered a similar somewhere, but I can't find the post!
you can invoke the menu:
in Hypermesh:
[. cget -menu].view.tab_area invoke "Right"
But if you use Hypermesh Desktop, menu widgets (and others) seem to be dynamically generated!
so we need to detect them, example proc:
proc callMainPulldown args { set mnuMain [. cget -menu] set mnuName $mnuMain set found [lrepeat [llength $args] 0] set cur 0 foreach inputText $args { set itemCount [$mnuName index end] for {set i 0} {$i <= $itemCount} {incr i} { if {[string equal "separator" [$mnuName type $i]]} continue set mnuText [$mnuName entrycget $i -label] if {[string equal -nocase $inputText $mnuText]} { lset found $cur 1 lset args $cur $mnuText if {[string equal "cascade" [$mnuName type $i]]} { set mnuName [$mnuName entrycget $i -menu] break } } } incr cur } set idx [lsearch -exact $found 0] if {$idx != -1} {return -code error "Error in callMainPulldown: Not found menu item '[lindex $args $idx]'"} $mnuName invoke [lindex $args end] } # usage: callMainPulldown View "Tab Area" Right # you can call other things: callMainPulldown xyplots create curves "single curve"
Thanks for the quick help.
0