diff options
author | culler <culler> | 2019-01-08 23:01:32 (GMT) |
---|---|---|
committer | culler <culler> | 2019-01-08 23:01:32 (GMT) |
commit | 3d9f5433b611ddba5d4c1f219d61bfcde319034f (patch) | |
tree | 8cd1abf09c4de523ab69edcbecc9d66f3b21ef75 /library | |
parent | cdcd80aec2e8f345a9a491e82129ab8ae0f864ea (diff) | |
parent | 4461111c77163d5fad79721108a7d52f83ed3e49 (diff) | |
download | tk-3d9f5433b611ddba5d4c1f219d61bfcde319034f.zip tk-3d9f5433b611ddba5d4c1f219d61bfcde319034f.tar.gz tk-3d9f5433b611ddba5d4c1f219d61bfcde319034f.tar.bz2 |
Implement local grabs on macOS.
Diffstat (limited to 'library')
-rw-r--r-- | library/demos/dialog1.tcl | 14 | ||||
-rw-r--r-- | library/demos/dialog2.tcl | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/library/demos/dialog1.tcl b/library/demos/dialog1.tcl index 5c572be..976e955 100644 --- a/library/demos/dialog1.tcl +++ b/library/demos/dialog1.tcl @@ -2,8 +2,16 @@ # # This demonstration script creates a dialog box with a local grab. +interp create slave +load {} Tk slave +slave eval { + wm title . slave + wm geometry . +700+30 + pack [text .t -width 30 -height 10] +} + after idle {.dialog1.msg configure -wraplength 4i} -set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any pointer-related events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications.} \ +set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "slave" which was created by a slave interpreter.} \ info 0 OK Cancel {Show Code}] switch $i { @@ -11,3 +19,7 @@ switch $i { 1 {puts "You pressed Cancel"} 2 {showCode .dialog1} } + +if {[interp exists slave]} { + interp delete slave +} diff --git a/library/demos/dialog2.tcl b/library/demos/dialog2.tcl index 2f45da8..6ae27a8 100644 --- a/library/demos/dialog2.tcl +++ b/library/demos/dialog2.tcl @@ -8,7 +8,8 @@ after idle { after 100 { grab -global .dialog2 } -set i [tk_dialog .dialog2 "Dialog with global grab" {This dialog box uses a global grab, so it prevents you from interacting with anything on your display until you invoke one of the buttons below. Global grabs are almost always a bad idea; don't use them unless you're truly desperate.} warning 0 OK Cancel {Show Code}] +set i [tk_dialog .dialog2 "Dialog with global grab" {This dialog box uses a global grab. If you are using an X11 window manager you will be prevented from interacting with anything on your display until you invoke one of the buttons below. This is almost always a bad idea; don't use global grabs with X11 unless you're truly desperate. On macOS systems you will not be able to interact with any window belonging to this process, but interaction with other macOS Applications will still be possible.}\ +warning 0 OK Cancel {Show Code}] switch $i { 0 {puts "You pressed OK"} |