Tk Source Code

Check-in [055ab275]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add docs and tests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bindScriptCount
Files: files | file ages | folders
SHA1:055ab275cc3840eb2284648aee156f528dde5e4b
User & Date: mistachkin 2012-11-16 22:09:07
Context
2014-11-11
22:23
Merge updates from core 8.5 branch. check-in: 63c3c355 user: mistachkin tags: bindScriptCount
2012-11-16
22:09
Add docs and tests. check-in: 055ab275 user: mistachkin tags: bindScriptCount
21:21
Add support for an 'M' binding substitution that is replaced with the number of script-based binding patterns matched so far for the event. check-in: 882be869 user: mistachkin tags: bindScriptCount
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to doc/bind.n.

544
545
546
547
548
549
550



551
552
553
554
555
556
557
.QW normal
event, \fB1\fR indicates that it is a
.QW synthetic
event generated by \fBSendEvent\fR.
.IP \fB%K\fR 5
The keysym corresponding to the event, substituted as a textual
string.  Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.



.IP \fB%N\fR 5
The keysym corresponding to the event, substituted as a decimal
number.  Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
.IP \fB%P\fR 5
The name of the property being updated or deleted (which
may be converted to an XAtom using \fBwinfo atom\fR.) Valid
only for \fBProperty\fR events.







>
>
>







544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
.QW normal
event, \fB1\fR indicates that it is a
.QW synthetic
event generated by \fBSendEvent\fR.
.IP \fB%K\fR 5
The keysym corresponding to the event, substituted as a textual
string.  Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
.IP \fB%M\fR 5
The number of script-based binding patterns matched so far for the
event.  Valid for all event types.
.IP \fB%N\fR 5
The keysym corresponding to the event, substituted as a decimal
number.  Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events.
.IP \fB%P\fR 5
The name of the property being updated or deleted (which
may be converted to an XAtom using \fBwinfo atom\fR.) Valid
only for \fBProperty\fR events.

Changes to tests/bind.test.

21
22
23
24
25
26
27








28
29
30
31
32
33
34
....
1561
1562
1563
1564
1565
1566
1567


















1568
1569
1570
1571
1572
1573
1574
    catch {destroy .b.f}
    frame .b.f -class Test -width 150 -height 100
    pack .b.f
    focus -force .b.f
    foreach p [event info] {event delete $p}    
    update
}








setup

foreach i [bind Test] {
    bind Test $i {}
}
foreach i [bind all] {
    bind all $i {}
................................................................................
test bind-16.44 {ExpandPercents procedure} {
    setup
    bind .b.f <Gravity> {set x "%R %S"}
    set x none
    event gen .b.f <Gravity>
    set x
} {?? ??}




















test bind-17.1 {event command} {
    list [catch {event} msg] $msg
} {1 {wrong # args: should be "event option ?arg?"}}
test bind-17.2 {event command} {
    list [catch {event xyz} msg] $msg







>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
....
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
    catch {destroy .b.f}
    frame .b.f -class Test -width 150 -height 100
    pack .b.f
    focus -force .b.f
    foreach p [event info] {event delete $p}    
    update
}
proc setup2 {} {
    catch {destroy .b.e}
    entry .b.e
    pack .b.e
    focus -force .b.e
    foreach p [event info] {event delete $p}
    update
}
setup

foreach i [bind Test] {
    bind Test $i {}
}
foreach i [bind all] {
    bind all $i {}
................................................................................
test bind-16.44 {ExpandPercents procedure} {
    setup
    bind .b.f <Gravity> {set x "%R %S"}
    set x none
    event gen .b.f <Gravity>
    set x
} {?? ??}
test bind-16.45 {ExpandPercents procedure} {
    setup2
    bind .b.e <Key> {set x "%M"}
    bind Entry <Key> {set y "%M"}
    bind all <Key> {set z "%M"}
    set x none; set y none; set z none
    event gen .b.e <Key-a>
    list $x $y $z
} {0 1 2}
test bind-16.46 {ExpandPercents procedure} {
    setup2
    bind all <Key> {set z "%M"}
    bind Entry <Key> {set y "%M"}
    bind .b.e <Key> {set x "%M"}
    set x none; set y none; set z none
    event gen .b.e <Key-a>
    list $x $y $z
} {0 1 2}


test bind-17.1 {event command} {
    list [catch {event} msg] $msg
} {1 {wrong # args: should be "event option ?arg?"}}
test bind-17.2 {event command} {
    list [catch {event xyz} msg] $msg