Tk Source Code

Artifact [a99bbe03]
Login

Artifact a99bbe03ee8d1f6662ed83ebd9a5eed64d54c05879ac6a7564909e660ce1e11c:

Attachment "DisplayVwaitBug2.tcl" to ticket [e2cec2fa] added by kjnash 2023-08-21 23:34:52.
# Example script for Tk ticket e2cec2fa41.

### Pick a value for ::varName.  The value will be the name of the
### vwait variable. It must be a fully qualified variable name.

### Bad Values - first use on a screen without the root window fails ###
set ::varName ::tk::Priv(button)
#set ::varName ::tk::Priv(button23)

### Good Values - first use on a screen without the root window succeeds ###
#set ::varName ::tk::PrivAlt(button)
#set ::varName ::newArray(button)
#set ::varName ::tk::PrivButton

proc tk::MessageBox0 {wParent} {
    if {$wParent eq {.}} {
        set wParent {}
    }
    set w $wParent.__tk__messagebox
    destroy $w
    toplevel $w
    label $w.l -text "Click to Close"
    button $w.b -text "OK" -command [list set $::varName ok]
    pack $w.l $w.b

    vwait $::varName

    set result [set $::varName]
    destroy $w
    return $result
}


toplevel .topa
if {[winfo screen .topa] eq ":0.0"} {
    set screen :1.0
} else {
    set screen :0.0
}

toplevel .topb -screen $screen

::tk::MessageBox0 .topb
# Click the button on the dialog on the topb screen to proceed.
exit