Jump to content
Sign in to follow this  

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

Recommended Posts

proc SetValueCallback { row col value } {
    puts "$value"
    return true
proc GetValueList {col row} {

  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

Share this post

Link to post
Share on other sites


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)

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...