How to get the entered value as a variable in the table

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

#::hwtk::table
proc SetValueCallback { row col value } {
    puts '$value'
    return true
}
proc GetValueList {col row} {
    return


  1. }
    ::hwtk::dialog .d -title '::hwtk::table'
    set table [::hwtk::table [.d recess].table]
    pack $table -fill both -expand true
    $table columncreate int -type int -text 'Integer' -validatecommand 'SetValueCallback %I %C %V'
    $table columncreate double -type real -text 'Double' -validatecommand 'SetValueCallback %I %C %V'
    $table columncreate color -type intcolor -image palette-16.png -validatecommand 'SetValueCallback %I %C %V'
    $table columncreate city -type combobox -text 'Combobox' -valuelistcommand 'GetValueList city' -validatecommand 'SetValueCallback %I %C %V'
    $table columncreate string -text 'String' -validatecommand 'SetValueCallback %I %C %V'
    for {set j 1} {$j < 5} {incr j} {
        set color [expr {int(rand()*64)}]
        set values 'int $j double $j.0 color $color city Troy string {String value $j}';
        $table rowinsert end row$j -values $values
    }
    .d post
    proc accept_func {args} {
         tk_messageBox -message 'You can have any function defined for this button' -title 'Accept Function' -icon info
         }
         

Answers

  • tinh
    tinh Altair Community Member
    edited September 2016

    Hi,

    the question is not clear

    a table widget has a variable, so get variable name by

    set table_var [$table cget -variable]

    => so cell value is stored in $table_var($row,$col)