#!../wafe --f
# Wafe script to demonstrate the behaviour of 
# waitForVariable, which implements 2nd level
# event loops 
#
# Gustaf Neuann   Sat Oct 30 19:28:07 GMT 1993

mergeResources topLevel *background wheat

Command a topLevel callback testing
 
TransientShell s a \
      popupCallback   {sV [parent %w] sensitive false} \
      popdownCallback {sV [parent %w] sensitive true}
  Form f s
  Label warn f \
     justify left \
     borderWidth 0 \
     label "What you want to do\nis really dangerous!\nContinue?"
  Command ok f callback {done %w} fromVert warn
  Command cancel f callback {done %w} fromHoriz ok fromVert warn
callback s popupCallback positionCursor 5

realize

proc done {result} {
   global answer
   popdown s
   set answer $result
}

proc testing {} {
   popup s none
   #now we want to wait for the user's reply...
   puts stderr "the answer is <[waitForVariable answer]>"
   #just to show that this happens after the shell is dismissed
   sV a background gray foreground red
}

