Tk Library Source Code

Artifact [4b70b6c44d]
Login

Artifact 4b70b6c44d95801d5c54966cf303f40fbeaff53b:

Attachment "ctrl-f.tcl" to ticket [784269ffff] added by mswan 2003-08-06 23:42:38.
lappend auto_path [file join /var/tmp/BWidget-1.6.0+]
package require BWidget

foreach key { f F \
		f1 f2 f3 f4 f5 f6 f7 f8 f9 \
		f11 f12 f13 f14 f15 f16 f17 f18 f19 \
		F1 F2 F3 F4 F5 F6 F7 F8 F9 \
		F11 F12 F13 F14 F15 F16 F17 F18 F19 } {
	if {[regexp {f[1]?[0-9]*} $key]} {
		puts "key '$key' matches the old pattern"
	} else {
		puts "key '$key' does not match the old pattern"
	}
	if {[regexp {f1?[0-9]} $key]} {
		puts "key '$key' matches the new pattern"
	} else {
		puts "key '$key' does not match the new pattern"
	}
}

wm withdraw .
wm title . "Test"
set descmenu {
	"&File" all file 0 {
		{command "&Quit" {} "Quit" {Ctrl q} \
			-command exit}
	}
	"&Edit" all edit 0 {
		{command "Find 1" {} "first try" {Ctrl f} \
			-command {puts "first try"}}
		{command "Find 2" {} "second try" {F1} \
			-command {puts "second try"}}
		{command "Find 3" {} "third try" {Ctrl F1} \
			-command {puts "third try"}}
	}
}
set data(mainframe) [MainFrame .mainframe \
	-menu $descmenu]
set subf [$data(mainframe) getframe]
set t [text $subf.log -wrap none \
	-width 80 -height 24]
pack $t
pack $data(mainframe) -side top -fill both -expand yes

BWidget::place . 0 0 center
wm deiconify .
raise .
focus -force .
wm geom . [wm geom .]