Menu

#1070 event generate ButtonPress-2

obsolete: 8.3.3
closed-duplicate
5
2001-12-28
2001-09-18
Anonymous
No

After generating a ButtonPress-2 event, whenever I move
within an entry widget there is an error:
Error: can't read "tkPriv(x)": no such element in array

The stack trace is:
can't read "tkPriv(x)": no such element in array
while executing
"if {abs(145-$tkPriv(x)) > 2} {
set tkPriv(mouseMoved) 1
}"
invoked from within
"if {!$tk_strictMotif} {
if {abs(145-$tkPriv(x)) > 2} {
set tkPriv(mouseMoved) 1
}
.test scan dragto 145
}
"
(command bound to event)

The following script shows the problem on tcl 8.3.3,
linux 2.4... Hit the Event button and move the pointer
within the entry widget and the error will appear.

proc Event {} {
# Adding this line causes the
event generate . <ButtonPress-2> -x 0 -y 0
}

proc SetUp {} {
button .event -text Event -command Event
button .exit -text Exit -command exit

entry .test
grid .test .event .exit
}

SetUp

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Probably another flavour of this:

    given the following commands:
    % pack [button .b -text middle-click] [entry .e]
    % bind .b <Button-2> "wm iconify ."

    then middle-click on the button, reopen and enter (move mouse in) the entry
    results in the same error.

     
  • Don Porter

    Don Porter - 2001-10-30
    • labels: --> 07. [entry]
    • assigned_to: nobody --> caflick
     
  • Don Porter

    Don Porter - 2001-10-30

    Logged In: YES
    user_id=80530

    It appears that the <B2-Motion> binding of the entry
    is being triggered. (because of a <ButtonPress> without
    a <Button-Release> ?)

    That binding needs to be robust against undefined
    slots in tk::Priv().

    There's a similar binding in [spinbox].

     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2001-10-31
    • assigned_to: caflick --> hobbs
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2001-12-28

    Logged In: YES
    user_id=72656

    This was a dup of 220269 essentially, which has a fix in
    8.4a4cvs.

     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2001-12-28
    • status: open --> closed-duplicate