How to get selected value from hwtk::selectlist widget
I'm trying to create a custom GUI window for a script I'm working on. I can't figure out how to use the selection picked by the user in the HWTK Select List widget. My select list widget is used to select one of the available material collectors in the model. When the user presses the OK button I want to get the ID number of the material collector the user clicked on. How do I do this?
Minimum working example of code attached at "forum_post_mew_selectMaterialList.tcl.txt"
Screenshot of what I'm working with in HyperMesh 2017:
Answers
-
HWTK studio has a nice example of this where it uses the selectlist object and the selection get command. I copied (and did slight edits of) what I thought was the relevant code but check out the HWTK GUI Toolkit for the selectlist example.
proc ::selectMaterialList::OnOk {} {
variable obj
puts "Selected items are --> [$obj selectionget]"
set ::selectMaterialList::selection [$obj selectionget]
$w unpost
}$w buttonconfigure ok -command "::texample::OnOk
I didn't test this but adding this into your code should get you close.
Happy coding.
0