av2.win.tcl

来自「很不错的tcl编程实例」· TCL 代码 · 共 100 行

TCL
100
字号
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

# Copyright 1996

# Authors

# Lakshmi Sastry
# Computing and Information Systems Department
# Rutherford Appleton Laboratory, Chilton, Didcot. OX11 0QX
# lakshmi.sastry@rl.ac.uk

#                         and

# Venkat VSS Sastry
# Department of Applied Mathematics and Operational Research
# Cranfield University, RMCS Shrivenham, Swindon, SN6 8LA
# sastry@rmcs.cran.ac.uk

# Permission to use, copy, modify, and distribute this
# software and its documentation for any purpose and without
# fee is hereby granted, provided that this copyright
# notice appears in all copies.
  
# The authors, RAL, RMCS Shrivenham, Cranfield University and AGOCG
# make no representations about the suitability of this
# software for any purpose.  It is provided "as is" without
# express or implied warranty. Likewise they accept no responsibility
# whatsoever for any public domain software modules used (which are
# hereby acknowledged) in this software.

# 修改:mhss<jijingzhisheng@up369.com>

package require dde 1.1 
dde servername av2


global aList vList 
set aList {}
set vList {}


frame .rc -bd 2
wm title . "Resources"
pack .rc

frame .rc.fff -height 40 
pack .rc.fff


# compute max length (in characters) of attribute
  

proc setCfg { b } {

	global aList vList

	set maxl 0

	foreach e $b {
		lappend aList [lindex $e 0]
		lappend vList [lindex $e 4]
		set a [lindex $e 0]
		if { [string length $a] > $maxl } {
			set maxl [string length $a]
		}
	}


	set i 0

	foreach a $aList {
		set ff [frame .rc.fff.sub$i]
		pack $ff
		label $ff.lab -text $a -width $maxl -anchor e
		entry $ff.ent
		bind $ff.ent <Return> [list ValCh $a]
		$ff.ent insert 0 [lindex $vList $i]
		pack $ff.lab $ff.ent -side left -in $ff
		incr i
	}

	button .rc.fff.b -text "Close" -com {exit}
	pack .rc.fff.b 
}

proc ValCh { a} {
	global aList vList;
	# get current value for a
	set idx [lsearch $aList $a]
	set va [.rc.fff.sub$idx.ent get]
	dde eval av [list reJig $va $a]
}


tkwait visibility .rc.fff

dde eval av {sendNow}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?