diff options
-rw-r--r-- | doc/bind.n | 2 | ||||
-rw-r--r-- | generic/tkBind.c | 2 | ||||
-rw-r--r-- | tests/bind.test | 60 |
3 files changed, 60 insertions, 4 deletions
@@ -351,7 +351,7 @@ position in the stacking order. .PP The last part of a long event specification is \fIdetail\fR. In the case of a \fBButtonPress\fR or \fBButtonRelease\fR event, it is the -number of a button (1\-5). If a button number is given, then only an +number of a button (1\-9). If a button number is given, then only an event on that particular button will match; if no button number is given, then an event on any button will match. Note: giving a specific button number is different than specifying a button modifier; diff --git a/generic/tkBind.c b/generic/tkBind.c index 9cd3b7b..cb516e8 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -3937,7 +3937,7 @@ ParseEventDescription( p = GetField(p, field, FIELD_SIZE); } if (*field != '\0') { - if ((*field >= '1') && (*field <= '5') && (field[1] == '\0')) { + if ((*field >= '1') && (*field <= '9') && (field[1] == '\0')) { if (eventFlags == 0) { patPtr->eventType = ButtonPress; eventMask = ButtonPressMask; diff --git a/tests/bind.test b/tests/bind.test index f38f03c..1b1107a 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -5757,8 +5757,8 @@ test bind-27.1 {button names} -body { bind .t <Expose-1> foo } -returnCodes error -result {specified button "1" for non-button event} test bind-27.2 {button names} -body { - bind .t <Button-6> foo -} -returnCodes error -result {specified keysym "6" for non-key event} + bind .t <Button-@> foo +} -returnCodes error -result {specified keysym "@" for non-key event} test bind-27.3 {button names} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f @@ -5829,6 +5829,62 @@ test bind-27.7 {button names} -setup { } -cleanup { destroy .t.f } -result {<Button-5> {button 5}} +test bind-27.8 {button names} -setup { + frame .t.f -class Test -width 150 -height 100 + pack .t.f + focus -force .t.f + update +} -body { + bind .t.f <Button-6> {lappend x "button 6"} + set x [bind .t.f] + event generate .t.f <Button-6> + event generate .t.f <ButtonRelease-6> + set x +} -cleanup { + destroy .t.f +} -result {<Button-6> {button 6}} +test bind-27.9 {button names} -setup { + frame .t.f -class Test -width 150 -height 100 + pack .t.f + focus -force .t.f + update +} -body { + bind .t.f <Button-7> {lappend x "button 7"} + set x [bind .t.f] + event generate .t.f <Button-7> + event generate .t.f <ButtonRelease-7> + set x +} -cleanup { + destroy .t.f +} -result {<Button-7> {button 7}} +test bind-27.10 {button names} -setup { + frame .t.f -class Test -width 150 -height 100 + pack .t.f + focus -force .t.f + update +} -body { + bind .t.f <Button-8> {lappend x "button 8"} + set x [bind .t.f] + event generate .t.f <Button-8> + event generate .t.f <ButtonRelease-8> + set x +} -cleanup { + destroy .t.f +} -result {<Button-8> {button 8}} +test bind-27.11 {button names} -setup { + frame .t.f -class Test -width 150 -height 100 + pack .t.f + focus -force .t.f + update +} -body { + bind .t.f <Button-9> {lappend x "button 9"} + set x [bind .t.f] + event generate .t.f <Button-9> + event generate .t.f <ButtonRelease-9> + set x +} -cleanup { + destroy .t.f +} -result {<Button-9> {button 9}} test bind-28.1 {keysym names} -body { bind .t <Expose-a> foo |