how can i get a value form combobox GUI?

Seçkin13
Seçkin13 Altair Community Member
edited October 2020 in Community Q&A

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]
   }

Tagged:

Answers

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited January 2020

    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
    Seçkin13 Altair Community Member
    edited January 2020

    Thanks Livil Lyle it worked :D/emoticons/default_biggrin.png' srcset='/emoticons/biggrin@2x.png 2x' title=':D' width='20' />