** Summary ** [Richard Suchenwirth] 2003-04-02: Here is a custom dialog - a toplevel that prompts for a value: ** Description ** [WikiDbImage valuedialog.jpg] ====== proc value_dialog {string} { set w [toplevel .[clock seconds]] wm resizable $w 0 0 wm title $w "Value request" label $w.l -text $string entry $w.e -textvar $w -bg white bind $w.e {set done 1} button $w.ok -text OK -command {set done 1} button $w.c -text Clear -command "set $w {}" button $w.cancel -text Cancel -command "set $w {}; set done 1" grid $w.l - - -sticky news grid $w.e - - -sticky news grid $w.ok $w.c $w.cancel vwait done destroy $w set ::$w } #----- Test set test [value_dialog "Give me a value please:"] puts test:$test pack [ label .l -text "Value: '$test' " ] ====== [MSW]: I wouldn't specify the entry's background, for a real reusable dialog, I'd check the option database to see if something exists. Imho such little snippets should use a global option hierarchy so you can easily integrate them into application which use the option database themselves. In my (standard wish) environment, I get an entry with white text on white background :) Aside of that, nice... [MSW]: What is not so nice is that you set ''result'' to "" instead of setting $w to "". I've changed that. [RS]: Yup - development residue: the global variable now named after the window was called ''result'', which is likely to conflict with other results... Thanks, you fixed it before I got the chance to do it ;-) ** See Also ** [Another little value dialog]: [A not-so-little value dialog]: <> GUI | Dialog | RS