I've found the following procedures to be very helpful in my
applications. They use the tk library, but I didn't come up with a way
to make them not depend on the name of the top level window. Use them if
you like.


proc dlg_confirm {msg} {
###############
# Procedure   : dlg_confirm
# Description : Pop up a CONFIRMATION dialog box, with YES & NO buttons
#               Default: <return> is YES, destroying the dialog box is
NO
# Arguments   : msg     - the confirmation question
# Returns     : YES or NO
###############

    set ans [tk_dialog .psAA.dlg Confirmation "$msg" questhead 0 YES NO]

    if {$ans == 0} {
        return YES
    } else {
        return NO
    }
}

proc dlg_error {msg} {
###############
# Procedure   : dlg_error
# Description : Pop up an ERROR dialog box, with an OK button
# Arguments   : msg     - the error message
# Returns     : Nothing
###############

    tk_dialog .psAA.dlg Error! "$msg" error -1 OK
}

proc dlg_question {msg args} {
###############
# Procedure   : dlg_question
# Description : Pop up a QUESTION dialog box, with answer buttons
#               Default: <return> is 0, destroying the dialog box is -1
# Arguments   : msg     - the question
#               args    - possible answers (button created for each)
# Returns     : offset to answer (0 is first button, 1 is second, etc.)
###############

    set ans [eval tk_dialog .psAA.dlg Question? {$msg} question 0 $args]

    return $ans
}

proc dlg_warn {msg} {
###############
# Procedure   : dlg_warn
# Description : Pop up a WARNING dialog box, with an OK button
# Arguments   : msg     - the warning message
# Returns     : Nothing
###############

    tk_dialog .psAA.dlg Warning! "$msg" warning -1 OK
}


______________________________________________
Gary M. Jaspersohn      | Email : [EMAIL PROTECTED]
PureSpeech              | Main  : (617) 441-0000
100 Cambridge Park Dr.  | Ext.  : 161
Cambridge, MA 02140     | Fax   : (617) 441-0001
____________________|_________________________
The opinions expressed above are entirely my own,
although I reserve the right to deny everything, and if
my opinions change, the fact that I am correct will not.
______________________________________________

> ----------------------------------------------------------------------
> -----
> To unsubscribe from the Visual Tcl mailing list, please send a message
> to [EMAIL PROTECTED] with "unsubscribe vtcl [EMAIL PROTECTED]" in
> the
> message body (where [EMAIL PROTECTED] is your e-mail address).
> 
---------------------------------------------------------------------------
To unsubscribe from the Visual Tcl mailing list, please send a message
to [EMAIL PROTECTED] with "unsubscribe vtcl [EMAIL PROTECTED]" in the
message body (where [EMAIL PROTECTED] is your e-mail address).

Reply via email to