A program to recognize and reward our most engaged community members
Hi,
I am trying to make tk GUI with N1,N2,N3 node choosen for vector defination. Is there any method or command I can use to create a GUI that the same in the Hyper Mesh panel to choose N1,N2,N3 node.
<?xml version="1.0" encoding="UTF-8"?>
Hi
There is available script to create it
refer to this file:
.../altair/14.0/hw/tcl/hw/collector/hwcollector.tcl
usage is similar to procedure 'TestHmCollector' in that file
But it looks dissimilar to hm style
you can customize it appearance following this:
proc ::p_Demo {f args} { set h [expr [lindex [hm_getpanelarea] end]/7-4] set font {{MS Sans Serif} 10} image create photo imgBlank frame $f set btype [button $f.btype -text \u36 -font {Marlett 14} -image imgBlank -compound left -highlightthickness 0 -width 25 -height $h] foreach b {N1 N2 N3} color {60c060 60c0c0 c06060} { button $f.b$b -text $b -bg #$color -activebackground #$color -font $font -image imgBlank -compound left -highlightthickness 0 -width 60 -height $h } set breset [button $f.breset -text \u7f\21 -font $font -image imgBlank -compound left -highlightthickness 0 -width 25 -height $h] pack $btype $f.bN1 $f.bN2 $f.bN3 $breset -side left -anchor w } p_Demo .demoCollector place .demoCollector -x 500 -y 500
Appearance is like this:
And, if you just need to call it instead of pack it in your toplevel, simply use command
set Vector [hm_getdirectionpanel]
/emoticons/default_wink.png' srcset='/emoticons/wink@2x.png 2x' title=';)' width='20' />
thank you a lots
one more question, please.
Do you know where I can find the explain for commands with namespace like this ' ::hwt:: '
Looking for 'Hyperworks GUI Toolkit' in reference help or in start>program>altair hyperworks>Tools
You should use hwtk from version 14, instead of hwt
Hi tinh,
I tried to create the N1,N2,N3 by using the following command
set s_vecFrame [ ::hwt::LabeledFrame [ ::hwt::WindowRecess col ].vf ' Vector Collectors ' -side top ] Collector $s_vecFrame.vc1 'N1,N2,N3' 1 HmVectorCol \ -withBase 1 \ -withReset 1 \ pack $s_vecFrame.vc1 -side top -anchor nw;
set s_vecFrame [ ::hwt::LabeledFrame [ ::hwt::WindowRecess col ].vf ' Vector Collectors ' -side top ]
Collector $s_vecFrame.vc1 'N1,N2,N3' 1 HmVectorCol \ -withBase 1 \ -withReset 1 \ pack $s_vecFrame.vc1 -side top -anchor nw;
But this is just GUI creation, How can I link three nodes I choose to the main procedure. I mean, how can I get the IDs of three nodes i choose or the vector defined by these nodes
retrieve them by callback proc, you are using HmVectorCol as callback proc, so maybe:
set n1 [HmVectorCol get n1]
set n2 [HmVectorCol get n2]
...
please test it
It doesn't work.
Moreover, I can not even pick node when use this panel.
I clicked N1, then choose a node but nothing happen at all, I can not pick any node on screen.
it was the same to N2 and N3.
For the Base node, when I tried to pick a node, there was an warning message in status bar that ' Unknown entity types found'
You should define your own callback proc, which calls hm_getdirectionpanel
HmVectorCol is just a sample callback , I think so
Hi Tinh,
I can get the vector define by these command by using
set vec_col [<pathname> get]
However, I still can not pick the node on screen.
May be Altair haven't completed the HmVectorCol macro yet because this issue doesn't happen to other collector.
I do not prefer to call hm_getdirectionpanel. I would like to pick the node directly without entering a panel. But seem like it is impossible.
Anyway, Thank you so much for your help.
You are really expert in this field ),
I am learning to write tkGUI but i found not much material about this in forum.
I am thankful if you can share me some of your experience like : where to learn, some example macros, how to improve the interface of GUI.
Thank you so much again
You can use HmMarkCol or HmListCol to activate graphic engine and then can pick nodes directly, plus using hm_framework to register a callback proc which acts on every click, this callback will take node id and make it blue, green, red by pass it to HmVectorCol set 1 n1 $nodeid