Script: creating a property sheet, assigning a value to variable

Ali Arapoğlu
Ali Arapoğlu Altair Community Member
edited March 5 in Community Q&A

Hello,

I'm trying to create a property sheet with tcl. I want to user to enter a value to input and trying to assign that value to an variable. But I cant make it work.

This is what I wrote;

set dlg [::hwtk::dialog .#auto -title "::hwtk::propertysheet"] set ps [::hwtk::propertysheet [$dlg recess].ps] $ps itemcreate cycle_1 -text "Cycle 1" -type real -help "of type int" -value "" -valueacceptcommand "set cycle_1 %V" pack $ps -fill both -expand true $ps fittocontent $dlg post

 

What I'm doing wrong? It doesn't assign entered value to variable.

 

In advance, thanks for the help.

Best Answer

  • Ben Buchanan
    Ben Buchanan
    Altair Employee
    edited March 5 Answer ✓

    The -valueacceptcommand is expecting a return value of 1 to know if it should accept the entered value. So I think you will need to create a procedure something like the below.

    proc SetValue {V} {     set cycle_1 $V     return 1 }

Answers

  • Ben Buchanan
    Ben Buchanan
    Altair Employee
    edited March 5 Answer ✓

    The -valueacceptcommand is expecting a return value of 1 to know if it should accept the entered value. So I think you will need to create a procedure something like the below.

    proc SetValue {V} {     set cycle_1 $V     return 1 }