HJG 2016-01-28: This is a fork of A little value dialog by Richard Suchenwirth, a small edit-value-dialog.
The immediate upcoming intended use is in MINISS - Mini Spread Sheet, together with that nice and short m+-menu routine.
This is a custom dialog - a toplevel that prompts for a value.
I have some ideas on how to modify the original value_dialog - routine, so I made a separate page here:
...
# # Input-Dialog: (from http://wiki.tcl.tk/8692 "A little value dialog" by R.Suchenwirth) # proc edit_val {string } { set w [toplevel .edit] #wm resizable $w 0 0 wm title $w "Edit cell" label $w.l -text $string #entry $w.e -textvar $w -bg white entry $w.e -textvariable ::val -width 20 bind $w.e <Return> {set done 1} set old $::val button $w.ok -text OK -command {set done 1} button $w.c -text Clear -command "set ::val {}" button $w.cancel -text Cancel -command "set ::val $old; set done 1" grid $w.l - - -sticky news grid $w.e - - -sticky news grid $w.ok $w.c $w.cancel raise $w . focus $w.e vwait done destroy $w set ::val; # ?? } # Demo: set val 123; # global var, for use with `-textvar` edit_val "Enter value:" #puts val:$val pack [ label .l -text "Result: '$val' " -pady 30 -padx 30 ] focus -f .
...