Hypermesh - Scripting- Tick box

Andy@LamteqSolutions
Andy@LamteqSolutions Altair Community Member
edited October 2020 in Community Q&A

Hi all,

 

I'm trying to put a script together which uses tickboxes but can't seem to find the command to produce a tickbox.

 

Anyone have any ideas?

 

Cheers

Andy

Tagged:

Answers

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited July 2020

    there is a toolkit called HWTK in HW installation.

     

    image.png.926bc13cbb83920c8d02ac22e9d09e12.png

     

    They might help you to get started.

     

  • Andy@LamteqSolutions
    Andy@LamteqSolutions Altair Community Member
    edited July 2020

    Awesome, many thanks Adriano

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited July 2020

    just as a hint that i've received from a colleague:

     

    Most of the examples start from a 'preview' frame, in HWTK gallery, which is not available in a regular HM session.

     

    So in order to use some widget, always create first a window/dialog, then start adding your buttons, checks, ...

     

    In the example, 'recess' is the name of the frame/dialog

    .

    hwtk::dialog .d -title Dialog -transient [winfo toplevel $w]
    .d hide apply
    .d post
    set recess [.d recess]

     

     

    after that, add your other statments.

     

    set w [hwtk::labelframe $recess.lf -text 'Saftey Check' -padding 2]
    pack $w -anchor nw -pady 4 -padx 4

    set i 0
    foreach option {'Wipers OK' 'Lights OK' 'Brakes OK' 'Driver Sober'} {
        set cb [hwtk::checkbutton $w.b$i -text $option]
        pack $cb -side top -fill x -pady 2 -padx 4
        incr i }

  • Andy@LamteqSolutions
    Andy@LamteqSolutions Altair Community Member
    edited July 2020

    Many thanks Adriano, 

     

    Am typically used to creating windows using 

    destroy .selection
    set f .selection;
    frame $f
    hm_framework addpanel $f 'Tool Selection';
    hm_framework drawpanel $f;

     

    Although I will give your version a go. 

     

    Something which does bother me is the padding 

    'pack $cb -side top -fill x -pady 2 -padx 4'

     

    Say I have 20 options and I use this code, a column of 6 tickboxes will appear in the window and the rest will simply not appear What I would like it to do is create columns. How do I get it to create several columns?

     

     

     

     

  • tinh
    tinh Altair Community Member
    edited July 2020

    Put the frame in a text box (hwtk text has scrollbars)

    And then get hull of textbox, use this hull as a frame to be added to hm panel