Jump to content

how can i get a value form combobox GUI?

Recommended Posts

Hi all 


I wrote this code for combobox. However when i change the list the results not.

I expect when this list's value changes, get the area and moi for selected beam sections.

Could you please help me?



hwtk::labelframe $w.lf3 -text "Defined List Only"
hwtk::combobox $w.lf3.cb -values $beam_list -help "BEAM SECTIONS" -textvariable beam_sect

switch -regexp -- $beam_sect {
   I {
      set Inertia [hm_getvalue beamsects name=I_beam dataname=results_Icentroid0]
      set dim_1 [hm_getvalue beamsects name=I_beam dataname=beamsect_dim1]
      set dim_2 [hm_getvalue beamsects name=I_beam dataname=beamsect_dim2]
      set dim_3 [hm_getvalue beamsects name=I_beam dataname=beamsect_dim3]
      set dim_4 [hm_getvalue beamsects name=I_beam dataname=beamsect_dim4]
      set dim_5 [hm_getvalue beamsects name=I_beam dataname=beamsect_dim5]
      set dim_6 [hm_getvalue beamsects name=I_beam dataname=beamsect_dim6]
      set aera  [hm_getvalue beamsects name=I_beam dataname=results_area]
      set Icog [hm_getvalue beamsects name=I_beam dataname=results_centroid0]
   C {
      set Inertia [hm_getvalue beamsects name=C_beam dataname=results_Icentroid0]
      set dim_1 [hm_getvalue beamsects name=C_beam dataname=beamsect_dim1]
      set dim_2 [hm_getvalue beamsects name=C_beam dataname=beamsect_dim2]
      set dim_3 [hm_getvalue beamsects name=C_beam dataname=beamsect_dim3]
      set dim_4 [hm_getvalue beamsects name=C_beam dataname=beamsect_dim4]
      set dim_5 [hm_getvalue beamsects name=C_beam dataname=beamsect_dim5]
      set dim_6 [hm_getvalue beamsects name=C_beam dataname=beamsect_dim6]
      set aera  [hm_getvalue beamsects name=C_beam dataname=results_area]
      set Icog [hm_getvalue beamsects name=C_beam dataname=results_centroid0]

Share this post

Link to post
Share on other sites

Hi Seckin,


Set the -textvariable as a namespace variable, you can do the below 


hwtk::labelframe $w.lf3 -text "Defined List Only"
hwtk::combobox $w.lf3.cb -values $beam_list -help "BEAM SECTIONS" -textvariable ::beam_sect


puts "$::beam_sect"

Seçkin13 likes this

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.

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...