How to get column value at selected row in hwtk::selectlist ?

Altair Community Member
Updated by Bhavik Sheth_21143
Hello,
I have created one selection list box for all the available components in the model with it's name in column 1 and ID in column 2.
My query is to get only component ID when user do the selection.
By using command "selectionget" we get all selected rows when user click on OK button.
So, how to fetch column 2(ID) value in selected row?
I have created below procedure for the same.
proc CompList {} { #Craete New Dialog to display Component List package require postquery set componentList [::hwp::getComponentList -byname 1] set componentIDList [::hwp::getComponentList -id 1] if {[winfo exists .d2]} {destroy .d2} set w2 [hwtk::dialog .d2 -title "Component List"] $w2 hide apply; set recess [$w2 recess] namespace eval ::texample {}; proc ::texample::OnSelect {W S c} { puts [info level 0] } proc ::texample::OnOk {w T} { puts "Selected items are --> [$T selectionget]" # puts "[llength [$T selectionget]]" set cnt [llength [$T selectionget]] } $w unpost } set selList [hwtk::selectlist $recess.sl -stripes 1 -selectmode multiple -selectcommand "::texample::OnSelect %W %S %c" -height 250 -width 500] #set selList [hwtk::selectlist $recess.sl -stripes 1 -selectmode multiple -height 250 -width 500] pack $selList -fill both -expand true; $selList columnadd entities -text Component_Name $selList columnadd id -text ID set cntCompList [llength $componentList] for {set i 0} {$i < $cntCompList } {incr i} { $recess.sl rowadd row$i -values [list entities "[lindex $componentList $i]" id "[lindex $componentIDList $i]"] } $w2 buttonconfigure ok -command "::texample::OnOk $w2 $selList" $w2 post }