Key Release binding
From: Shamil D. (shamild_at_hotmail.com)
Date: 04/01/04
- Next message: lvirden_at_yahoo.com: "Re: Virus warning w.r.t. starkits"
- Previous message: Don Libes: "Re: Expect, telnet, frozen console."
- Next in thread: Aric Bills: "Re: Key Release binding"
- Reply: Aric Bills: "Re: Key Release binding"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 1 Apr 2004 08:35:46 -0800
I have an application in which the user enters customer ID and then
that customer's name and other information is automatically displayed
in adjacent entries. I want the user to be able to enter two customer
IDs in one screen. However, I'm finding some awkward behavior when
using a "KeyRelease" binding inside a loop. The "set var $ent($j)"
command fails because for some reason j is incremented to 3. Any idea
why it's doing that?
Below is a simplified code that reproduces the error.
Shamil D.
#-------------- begining of code --------------
for {set j 1} {$j <= 2} {incr j} { ;# open brace 1
entry .e$j -textvariable ent($j)
entry .r$j -textvariable res($j)
entry .n$j -textvariable nop($j)
pack .e$j .r$j .n$j
bind .e$j <KeyRelease> {
set var $ent($j)
if {[string length $var] == 3} {
if {[info exists who($var)]} {
set res($j) $who($ent($j))
set nop($j) $age($ent($j))
}
} else {
set res($j) {}
set nop($j) {}
}
}
} ;# close brace 1
set who(100) Joe; set who(200) Sam; set who(300) Kevin;
set age(100) 26; set age(200) 33; set age(300) 15
#---------------- end of code ----------------
- Next message: lvirden_at_yahoo.com: "Re: Virus warning w.r.t. starkits"
- Previous message: Don Libes: "Re: Expect, telnet, frozen console."
- Next in thread: Aric Bills: "Re: Key Release binding"
- Reply: Aric Bills: "Re: Key Release binding"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|