How to Customize the panel area

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

I want to add  radio button  below the input box and need customized Action button. below the panel area.

 

img233.jpg

 

I used hm_getstring to make input box, but i could not add radio button.
* I dont want make separate window using TK. 

 

 

 

I want make to radio button .

consider radio button  opt1, opt 2
if opt1 selected  one proc need execute if opt2 selected another proc need execute

 

 

 set text [hm_getstring 'prefix or suffix Text' 'Enter the text']   # if OPT1--------------------------------- *createmarkpanel comps 1 'Select Component to Rename'  set my_comps [hm_getmark comps 1]   foreach c $my_comps {  	set name [hm_getentityvalue comps $c name 1]  	set new_name [format '%s_$text' $name]  	eval *renamecollector components '$name' '$new_name'  }   *clearmark comps 1 #------------------------------------------------   # if OPT2---------------------------------   *createmarkpanel comps 1 'Select Component to Rename'  set my_comps [hm_getmark comps 1]   foreach c $my_comps {  	set name [hm_getentityvalue comps $c name 1]  	set new_name [format '$text _%s' $name]  	eval *renamecollector components '$name' '$new_name'  }   *clearmark comps 1  #------------------------------------------------

 

 

 

Answers

  • tinh
    tinh Altair Community Member
    edited October 2020

    Hi

    hm_getstring, hm_getfloat, hm_getint will create proper panels and they are not Tk panel

    You can create a Tk panel, puts radiobutton, entrybox, command buttons,... on it. Then use hm_framework to draw the Tk panel.

    Hm will return to interpreter after drawing, so you need to set a trigger to wait until user exit panel then return interpreter.

     

    Example

    set frm [frame .mypanel]

    set lbl [label $frm.lbl -text Input]

    set ent [entry $frm.ent]

    set r1 [radiobutton $frm.r1]

    set r2 [radiobutton $frm.r2]

    proc myProc args {

    ... Add your process here

    set ::myVar 1

    }

    set btn [button $frm.b -text Proceed -command myProc]

    proc myReturn args {

    ...

    hm_exitpanel

    set ::myVar 0

    }

    set ebtn [button $frm.return -text return -command myReturn]

    eval pack [winfo children $frm]

    set ::myVar -1

    #draw it

    hm_framework addpanel $frm 'My Panel'

    hm_framework drawpanel 'My Panel'

    #wait for user click proceed or return:

    tkwait variable ::myVar

     

     

    Refer

    https://community.altair.com/community?id=a966ccf61b2bd0908017dc61ec4bcbc0