1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153
|
<!DOCTYPE html>
<html>
<head>
<title>Wcb Command Reference</title>
<meta name="Author" content="Csaba Nemethi">
<meta name="Keywords" content=
"callback, widget, Tk entry, Ttk entry, BWidget Entry, Tk spinbox, Ttk spinbox, Ttk combobox, listbox, tablelist, Ttk treeview, text, ctext">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<div align="center">
<h1>Wcb Command Reference</h1>
<h2>For Wcb Version 4.1</h2>
<h3>by</h3>
<h2>Csaba Nemethi</h2>
<address>
<a href="mailto:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>
</address>
</div>
<hr>
<h2 id="contents">Contents</h2>
<ul>
<li><a href="#callback">The <code><b>wcb::callback</b></code>
Command</a></li>
<li><a href="#cbappend">The <code><b>wcb::cbappend</b></code>
Command</a></li>
<li><a href="#cbprepend">The <code><b>wcb::cbprepend</b></code>
Command</a></li>
<li><a href="#cancel">The <code><b>wcb::cancel</b></code> Command</a></li>
<li><a href="#canceled">The <code><b>wcb::canceled</b></code>
Command</a></li>
<li><a href="#extend">The <code><b>wcb::extend</b></code> Command</a></li>
<li><a href="#replace">The <code><b>wcb::replace</b></code>
Command</a></li>
<li><a href="#pathname">The <code><b>wcb::pathname</b></code>
Command</a></li>
<li><a href="#changeEntryText">The <code><b>wcb::changeEntryText</b></code>
Command</a></li>
<li><a href="#postInsertEntryLen">The
<code><b>wcb::postInsertEntryLen</b></code> Command</a></li>
<li><a href="#postInsertEntryText">The
<code><b>wcb::postInsertEntryText</b></code> Command</a></li>
<li><a href="#postDeleteEntryText">The
<code><b>wcb::postDeleteEntryText</b></code> Command</a></li>
<li><a href="#entrycb">Before-<code><b>insert</b></code> Callbacks for
entry, spinbox, and combobox Widgets</a></li>
<li><a href="#textcb">Before-<code><b>insert</b></code> Callbacks for text
and ctext Widgets</a></li>
</ul>
<div align="center">
<p><a href="index.html">Start page</a></p>
</div>
<hr>
<h2 id="callback">The <code><b>wcb::callback</b></code> Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::callback</code> – Retrieve, set, and remove widget
callbacks</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::callback</b> <i>widgetName</i> <b>before</b>|<b>after</b> <i>option</i> ?<i>callback</i> <i>callback</i> ...?
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>Retrieves, sets, or removes the callbacks for the Tk or Ttk entry,
BWidget Entry, Tk or Ttk spinbox, Ttk combobox, listbox, tablelist, Ttk
treeview, text, or ctext widget <code><i>widgetName</i></code>, the
argument <code><b>before</b></code> or <code><b>after</b></code>, and the
command corresponding to <code><i>option</i></code>. The values of
the <code><i>option</i></code> argument can be:</dd>
<dd class="tm">
<ul>
<li><code><b>insert</b></code>, <code><b>delete</b></code>, or
<code><b>motion</b></code>, for a Tk or Ttk entry, BWidget Entry, Tk
or Ttk spinbox, Ttk combobox, text, or ctext widget;</li>
<li><code><b>replace</b></code>, for a text or ctext widget;</li>
<li><code><b>activate</b></code>, for a listbox, tablelist, or Ttk
treeview widget;</li>
<li><code><b>selset</b></code> or <code><b>selclear</b></code>, for a
listbox, tablelist, Ttk treeview, text, or ctext widget;</li>
<li><code><b>seladd</b></code> or <code><b>seltoggle</b></code>, for a
Ttk treeview widget;</li>
<li><code><b>cellselset</b></code> or <code><b>cellselclear</b></code>,
for a tablelist or Ttk treeview widget;</li>
<li><code><b>cellseladd</b></code> or
<code><b>cellseltoggle</b></code>, for a Ttk treeview widget;</li>
<li><code><b>activatecell</b></code>, for a tablelist widget.</li>
</ul>
</dd>
<dd class="tm">If no arguments after the <code><i>option</i></code>
parameter are specified, then the procedure just returns the current
before- or after-callback list, respectively, for the given widget
operation.</dd>
<dd class="tm">Otherwise:</dd>
<dd>
<ul>
<li>
<p>If at least one of the arguments following the
<code><i>option</i></code> parameter is a nonempty string, then:</p>
<ul>
<li>if called for the first time for this widget with at least one
nonempty argument following the <code><i>option</i></code>
parameter, then the procedure renames the Tcl command
<code>::<i>widgetName</i></code> to
<code>::_<i>widgetName</i></code> and builds a new procedure
<code>::<i>widgetName</i></code>, in which the execution of the
widget operations associated with the above values of
<code><i>option</i></code> is preceded by invocations of the
corresponding before-callbacks and followed by calls to the
corresponding after-callbacks, in the global scope;</li>
<li class="tm">it sets the callback list to the one built from
these arguments and returns the new list.</li>
</ul>
</li>
<li class="tm">If all arguments following the
<code><i>option</i></code> parameter are empty, then the procedure
unregisters all the corresponding before- or after-callbacks for the
given widget and returns an empty string.</li>
</ul>
</dd>
<dd class="tm">When a callback is invoked for the widget
<code><i>widgetName</i></code>, the name of the <b>proxy command</b>
<code>::_<i>widgetName</i></code> and the command arguments are
automatically appended to it as parameters. Use the <code><b><a href=
"#pathname">wcb::pathname</a></b></code> command to retrieve the original
widget path name.</dd>
<dd class="tm">The following table shows the widget subcommands
corresponding to the above values of <code><i>option</i></code>, together
with the arguments of these subcommands:</dd>
<dd class="tm" id="callback_table">
<table border="2" cellspacing="0" cellpadding="3">
<tr bgcolor="#FFFFE0">
<th align="left">Widget</th>
<th align="left"><code><i>option</i></code></th>
<th align="left">Subcommand</th>
<th align="left">Arguments</th>
</tr>
<tr>
<td rowspan="3">Tk entry, ttk::entry,<br>
BWidget Entry,<br>
Tk spinbox, ttk::spinbox,<br>
or ttk::combobox</td>
<td><code><b>insert</b></code></td>
<td><code><b>insert</b></code></td>
<td><code><i>index</i> <i>string</i></code></td>
</tr>
<tr>
<td><code><b>delete</b></code></td>
<td><code><b>delete</b></code></td>
<td><code><i>from</i> ?<i>to</i>?</code></td>
</tr>
<tr>
<td><code><b>motion</b></code></td>
<td><code><b>icursor</b></code></td>
<td><code><i>index</i></code></td>
</tr>
<tr>
<td rowspan="3">listbox</td>
<td><code><b>activate</b></code></td>
<td><code><b>activate</b></code></td>
<td><code><i>index</i></code></td>
</tr>
<tr>
<td><code><b>selset</b></code></td>
<td><code><b>selection set</b></code></td>
<td><code><i>first</i> ?<i>last</i>?</code></td>
</tr>
<tr>
<td><code><b>selclear</b></code></td>
<td><code><b>selection clear</b></code></td>
<td><code><i>first</i> ?<i>last</i>?</code></td>
</tr>
<tr>
<td rowspan="6">tablelist::tablelist</td>
<td><code><b>activate</b></code></td>
<td><code><b>activate</b></code></td>
<td><code><i>index</i></code></td>
</tr>
<tr>
<td><code><b>selset</b></code></td>
<td><code><b>selection set</b></code></td>
<td><code><i>first</i> ?<i>last</i>?</code>
(<code><i>indexList</i></code> or
<code><i>firstIndex</i> <i>lastIndex</i></code>)</td>
</tr>
<tr>
<td><code><b>selclear</b></code></td>
<td><code><b>selection clear</b></code></td>
<td><code><i>first</i> ?<i>last</i>?</code>
(<code><i>indexList</i></code> or
<code><i>firstIndex</i> <i>lastIndex</i></code>)</td>
</tr>
<tr>
<td><code><b>activatecell</b></code></td>
<td><code><b>activatecell</b></code></td>
<td><code><i>cellIndex</i></code></td>
</tr>
<tr>
<td><code><b>cellselset</b></code></td>
<td><code><b>cellselection set</b></code></td>
<td><code><i>first</i> ?<i>last</i>?</code>
(<code><i>cellIndexList</i></code> or
<code><i>firstCell</i> <i>lastCell</i></code>)</td>
</tr>
<tr>
<td><code><b>cellselclear</b></code></td>
<td><code><b>cellselection clear</b></code></td>
<td><code><i>first</i> ?<i>last</i>?</code>
(<code><i>cellIndexList</i></code> or
<code><i>firstCell</i> <i>lastCell</i></code>)</td>
</tr>
<tr>
<td rowspan="9">ttk::treeview</td>
<td><code><b>activate</b></code></td>
<td><code><b>focus</b></code></td>
<td><code><i>item</i></code></td>
</tr>
<tr>
<td><code><b>selset</b></code></td>
<td><code><b>selection set</b></code></td>
<td><code><i>itemList</i></code></td>
</tr>
<tr>
<td><code><b>seladd</b></code></td>
<td><code><b>selection add</b></code></td>
<td><code><i>itemList</i></code></td>
</tr>
<tr>
<td><code><b>selclear</b></code></td>
<td><code><b>selection remove</b></code></td>
<td><code><i>itemList</i></code></td>
</tr>
<tr>
<td><code><b>seltoggle</b></code></td>
<td><code><b>selection toggle</b></code></td>
<td><code><i>itemList</i></code></td>
</tr>
<tr>
<td><code><b>cellselset</b></code></td>
<td><code><b>cellselection set</b></code></td>
<td><code><i>first</i> ?<i>last</i>?</code>
(<code><i>cellList</i></code> or
<code><i>firstCell</i> <i>lastCell</i></code>)</td>
</tr>
<tr>
<td><code><b>cellseladd</b></code></td>
<td><code><b>cellselection add</b></code></td>
<td><code><i>first</i> ?<i>last</i>?</code>
(<code><i>cellList</i></code> or
<code><i>firstCell</i> <i>lastCell</i></code>)</td>
</tr>
<tr>
<td><code><b>cellselclear</b></code></td>
<td><code><b>cellselection remove</b></code></td>
<td><code><i>first</i> ?<i>last</i>?</code>
(<code><i>cellList</i></code> or
<code><i>firstCell</i> <i>lastCell</i></code>)</td>
</tr>
<tr>
<td><code><b>cellseltoggle</b></code></td>
<td><code><b>cellselection toggle</b></code></td>
<td><code><i>first</i> ?<i>last</i>?</code>
(<code><i>cellList</i></code> or
<code><i>firstCell</i> <i>lastCell</i></code>)</td>
</tr>
<tr>
<td rowspan="6">text or ctext</td>
<td><code><b>insert</b></code></td>
<td><code><b>insert</b></code></td>
<td><code><i>index</i> <i>string</i> ?<i>tagList</i> <i>string</i>
<i>tagList</i> ...?</code></td>
</tr>
<tr>
<td><code><b>delete</b></code></td>
<td><code><b>delete</b></code></td>
<td><code><i>from</i> ?<i>to</i>?</code></td>
</tr>
<tr>
<td><code><b>replace</b></code></td>
<td><code><b>replace</b></code></td>
<td><code><i>from</i> <i>to</i> <i>string</i> ?<i>tagList</i>
<i>string</i> <i>tagList</i> ...?</code></td>
</tr>
<tr>
<td><code><b>motion</b></code></td>
<td><code><b>mark set insert</b></code></td>
<td><code><i>index</i></code></td>
</tr>
<tr>
<td><code><b>selset</b></code></td>
<td><code><b>tag add sel</b></code></td>
<td><code><i>from</i> ?<i>to</i> <i>from</i> <i>to</i>
...?</code></td>
</tr>
<tr>
<td><code><b>selclear</b></code></td>
<td><code><b>tag remove sel</b></code></td>
<td><code><i>from</i> ?<i>to</i> <i>from</i> <i>to</i>
...?</code></td>
</tr>
</table>
</dd>
<dd class="tm"><b>REMARKS:</b></dd>
<dd class="tm">
<ol>
<li>You may abbreviate the words <code><b>before</b></code>,
<code><b>after</b></code>, <code><b>insert</b></code>,
<code><b>delete</b></code>, <code><b>replace</b></code>,
<code><b>motion</b></code>, and <code><b>activate</b></code> (the
latter not for tablelist widgets) to a minimum of one character.
Similarly, the first four characters of the words
<code><b>selset</b></code>, <code><b>selclear</b></code>,
<code><b>seladd</b></code>, and <code><b>seltoggle</b></code>, the
first eight characters of <code><b>cellselset</b></code>,
<code><b>cellselclear</b></code>, <code><b>cellseladd</b></code>, and
<code><b>cellseltoggle</b></code>, and the first nine characters of
<code><b>activatecell</b></code> are sufficient for Wcb to recognize
these options.</li>
<li class="tm">After a successful invocation of this command with at
least one nonempty callback following the <code><i>option</i></code>
argument, you can use either the new procedure
<code><i>widgetName</i></code> or the proxy command
<code>::_<i>widgetName</i></code> to perform any valid operation on the
widget <code><i>widgetName</i></code>. Use the proxy command
<code>::_<i>widgetName</i></code> if you want to prevent the callbacks
from being invoked when executing the respective widget
subcommand.</li>
<li class="tm">When destroying a widget <code><i>widgetName</i></code>
for which <code><b>wcb::callback</b></code> has replaced the
corresponding Tcl command with a new procedure, the proxy command
<code>::_<i>widgetName</i></code> is deleted automatically by the Tcl
interpreter (this is not true in the case of a BWidget Entry,
tablelist, or ctext widget). The new widget procedure
<code><i>widgetName</i></code> would persist, but Wcb arranges for it
to be deleted from within a cleanup script bound to the
<code><b><Destroy></b></code> event. This cleanup script is
associated with a binding tag called <code><b>WcbCleanup</b></code>,
which is appended to the list of binding tags of the widget the first
time when registering some callbacks for it. (In the case of a
BWidget Entry, tablelist, or ctext widget, this script also deletes the
proxy command <code>::_<i>widgetName</i></code>.)</li>
<li class="tm">The cleanup script mentioned above also unregisters all
callbacks defined for <code><i>widgetName</i></code>, thus ensuring
that a widget with the same path created later will not inherit them
from the widget just deleted (this can be important in some
applications). For this reason, you should be careful not to
remove <code><b>WcbCleanup</b></code> from the list of binding tags of
the given widget!</li>
</ol>
</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>callback, widget, Tk entry, Ttk entry, BWidget Entry, Tk spinbox, Ttk
spinbox, Ttk combobox, listbox, tablelist, Ttk treeview, text, ctext</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="cbappend">The <code><b>wcb::cbappend</b></code> Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::cbappend</code> – Append to a callback list</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::cbappend</b> <i>widgetName</i> <b>before</b>|<b>after</b> <i>option</i> ?<i>callback</i> <i>callback</i> ...?
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>This command is almost identical to <code><b><a href=
"#callback">wcb::callback</a></b></code>. The only difference is that
<code><b>wcb::cbappend</b></code> <i>appends</i> the arguments specified
after the <code><i>option</i></code> parameter to the current callback list
(if present), while <code><b>wcb::callback</b></code> <i>replaces</i> the
old callbacks with these arguments.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>callback, append, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="cbprepend">The <code><b>wcb::cbprepend</b></code> Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::cbprepend</code> – Prepend to a callback list</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::cbprepend</b> <i>widgetName</i> <b>before</b>|<b>after</b> <i>option</i> ?<i>callback</i> <i>callback</i> ...?
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>This command is almost identical to <code><b><a href=
"#callback">wcb::callback</a></b></code>. The only difference is that
<code><b>wcb::cbprepend</b></code> <i>prepends</i> the arguments specified
after the <code><i>option</i></code> parameter to the current callback list
(if present), while <code><b>wcb::callback</b></code> <i>replaces</i> the
old callbacks with these arguments.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>callback, prepend, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="cancel">The <code><b>wcb::cancel</b></code> Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::cancel</code> – Cancel a widget command</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::cancel</b> ?<i>script</i>?
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>This procedure is designed to be invoked from a before-callback for a
widget command. It cancels the execution of that command and of the
remaining callbacks, and evaluates the <code><i>script</i></code> argument
in the global scope. If this argument is not specified, it defaults
to the <code><b>bell</b></code> command.</dd>
<dd class="tm">The return value is the one obtained from
<code><i>script</i></code> if this argument is specified and
nonempty. Otherwise, the command returns an empty string.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>cancel, command, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="canceled">The <code><b>wcb::canceled</b></code> Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::canceled</code> – Query the canceled status of a
widget command</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::canceled</b> <i>widgetName</i> <i>option</i>
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>Returns the value <code>1</code> if the most recent invocation of the
widget operation corresponding to <code><i>widgetName</i></code> and
<code><i>option</i></code> has been aborted by some before-callback by
invoking <code><b><a href="#cancel">wcb::cancel</a></b></code>; otherwise,
the return value is <code>0</code>. The arguments must fulfil the
same restrictions as in the case of the <code><b><a href=
"#callback">wcb::callback</a></b></code> command.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>cancel, command, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="extend">The <code><b>wcb::extend</b></code> Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::extend</code> – Extend the argument list of a widget
command</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::extend</b> ?<i>arg</i> <i>arg</i> ...?
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>This procedure is designed to be invoked from a before-callback for a
widget command. It appends the values given in the optional
<code><i>arg</i></code> parameters to the argument list of that
command. The new argument list will be passed to the remaining
callbacks for that command, too.</dd>
<dd class="tm">This procedure simply passes its parameters to the
<code><b>lappend</b></code> command, called for the argument list of the
respective widget operation.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>extend, argument, command, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="replace">The <code><b>wcb::replace</b></code> Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::replace</code> – Replace arguments of a widget command
with new ones</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::replace</b> <i>first</i> <i>last</i> ?<i>arg</i> <i>arg</i> ...?
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>This procedure is designed to be invoked from a before-callback for a
widget command. It replaces the arguments having the indices
<code><i>first</i></code> through <code><i>last</i></code> of that command
with the optional <code><i>arg</i></code> parameters. The new
argument list will be passed to the remaining callbacks for that command,
too. The arguments are numbered from <code>0</code> (see the <a href=
"#callback_table">table</a> in the description of the <code><b><a href=
"#callback">wcb::callback</a></b></code> command).</dd>
<dd class="tm">This procedure simply passes its parameters to the
<code><b>lreplace</b></code> command, called for the argument list of the
respective widget operation.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>replace, argument, command, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="pathname">The <code><b>wcb::pathname</b></code> Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::pathname</code> – Query the path name of the widget
corresponding to a Tcl command name</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::pathname</b> <i>proxyCmd</i>
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>This procedure returns the path name of the widget corresponding to the
Tcl command name <code><i>proxyCmd</i></code> passed to a callback.</dd>
<dd class="tm">When a before- or after-callback for a widget is invoked,
the name of the proxy command associated with that widget is automatically
appended to it as parameter. This procedure can be used within a
callback to retrieve the path name of the widget from the command name
passed to the callback as argument. It simply returns the string
range obtained from <code><i>proxyCmd</i></code> by removing the
<code>"::_"</code> prefix.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>path name, command, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="changeEntryText">The <code><b>wcb::changeEntryText</b></code>
Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::changeEntryText</code> – Change the text of a Tk or
Ttk entry, BWidget Entry, Tk or Ttk spinbox, or Ttk combobox widget</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::changeEntryText</b> <i>widgetName string</i>
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>Replaces the text of the Tk or Ttk entry, BWidget Entry, Tk or Ttk
spinbox, or Ttk combobox widget <code><i>widgetName</i></code> with
<code><i>string</i></code>, by using the <code><b>delete</b></code> and
<code><b>insert</b></code> operations. If the first subcommand is
canceled by some before-<code><b>delete</b></code> callback then the
procedure returns without inserting the new text; if the second operation
is canceled by some before-<code><b>insert</b></code> callback then the
command restores the original contents of the widget.</dd>
<dd class="tm">The procedure keeps the position of the insertion
cursor. The return value is <code>1</code> on success and
<code>0</code> on failure, i.e., if one of the attempted operations was
canceled by some before-callback.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>Tk entry, Ttk entry, BWidget Entry, Tk spinbox, Ttk spinbox, Ttk
combobox, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="postInsertEntryLen">The <code><b>wcb::postInsertEntryLen</b></code>
Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::postInsertEntryLen</code> – Query the would-be length
of the text in a Tk or Ttk entry, BWidget Entry, Tk or Ttk spinbox, or Ttk
combobox widget after text insertion</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::postInsertEntryLen</b> <i>widgetName string</i>
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>Returns the length of the text that would be contained in the Tk or Ttk
entry, BWidget Entry, Tk or Ttk spinbox, or Ttk combobox widget
<code><i>widgetName</i></code> after inserting
<code><i>string</i></code>.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>insert, Tk entry, Ttk entry, BWidget Entry, Tk spinbox, Ttk spinbox,
Ttk combobox, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="postInsertEntryText">The <code><b>wcb::postInsertEntryText</b></code>
Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::postInsertEntryText</code> – Query the would-be text
of a Tk or Ttk entry, BWidget Entry, Tk or Ttk spinbox, or Ttk combobox
widget after text insertion</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::postInsertEntryText</b> <i>widgetName index string</i>
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>Returns the text that would be contained in the Tk or Ttk entry,
BWidget Entry, Tk or Ttk spinbox, or Ttk combobox widget
<code><i>widgetName</i></code> after inserting <code><i>string</i></code>
before the character indicated by <code><i>index</i></code>.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>insert, Tk entry, Ttk entry, BWidget Entry, Tk spinbox, Ttk spinbox,
Ttk combobox, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="postDeleteEntryText">The <code><b>wcb::postDeleteEntryText</b></code>
Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::postDeleteEntryText</code> – Query the would-be text
of a Tk or Ttk entry, BWidget Entry, Tk or Ttk spinbox, or Ttk combobox
widget after text deletion</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::postDeleteEntryText</b> <i>widgetName from</i> ?<i>to</i>?
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>Returns the text that would be contained in the Tk or Ttk entry,
BWidget Entry, Tk or Ttk spinbox, or Ttk combobox widget
<code><i>widgetName</i></code> after deleting the characters starting with
the one indicated by the index <code><i>from</i></code> and stopping just
before <code><i>to</i></code>. If <code><i>to</i></code> is not
specified then the return value is the text that would be contained in the
widget after deleting the single character given by
<code><i>from</i></code>.</dd>
<dd class="tm"><b>REMARK:</b> This command has a variable number (2
or 3) of arguments, because the <code><b>delete</b></code> subcommand of
the Tcl command associated with <code><i>widgetName</i></code> expects
either one or two indices as arguments. For this reason, the correct
way to invoke this command from within a before-<code><b>delete</b></code>
callback is as shown in the following example:</dd>
<dd>
<blockquote>
<pre>
proc myBeforeDeleteCallback {w args} {
<span class="cmt">#
# Get the text that would be contained in the widget after
# deleting the characters specified by $args, which stands
# for the one or two arguments passed to delete; pass these
# arguments to wcb::postDeleteEntryText by expanding $args
#</span>
set newText [eval [list wcb::postDeleteEntryText $w] $args]
if {!<i>some_condition_on_</i>$newText} {
wcb::cancel
}
}
</pre>
</blockquote>
</dd>
<dd>The following alternative, more elegant solution requires Tcl/Tk 8.5 or
later:</dd>
<dd>
<blockquote>
<pre>
proc myBeforeDeleteCallback {w args} {
<span class="cmt"># . . .</span>
set newText [wcb::postDeleteEntryText $w {*}$args]
. . .
}
</pre>
</blockquote>
</dd>
<dt><b>KEYWORDS</b></dt>
<dd>delete, Tk entry, Ttk entry, BWidget Entry, Tk spinbox, Ttk spinbox,
Ttk combobox, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="entrycb">Before-<code><b>insert</b></code> Callbacks for entry,
spinbox, and combobox Widgets</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::checkStrFor*</code>, <code>wcb::convStrTo*</code>,
<code>wcb::checkEntryFor*</code>, <code>wcb::checkEntryLen</code> –
Before-<code><b>insert</b></code> callbacks for Tk entry, Ttk entry,
BWidget Entry, Tk spinbox, Ttk spinbox, and Ttk combobox widgets</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::checkStrForRegExp</b> <i>exp w idx str</i>
<b>wcb::checkStrForAlpha</b> <i> w idx str</i>
<b>wcb::checkStrForNum</b> <i> w idx str</i>
<b>wcb::checkStrForAlnum</b> <i> w idx str</i>
<b>wcb::convStrToUpper</b> <i> w idx str</i>
<b>wcb::convStrToLower</b> <i> w idx str</i>
<b>wcb::checkEntryForInt</b> <i> w idx str</i>
<b>wcb::checkEntryForUInt</b> <i>max w idx str</i>
<b>wcb::checkEntryForReal</b> <i> w idx str</i>
<b>wcb::checkEntryForFixed</b> <i>cnt w idx str</i>
<b>wcb::checkEntryLen</b> <i>len w idx str</i>
</pre>
</dd>
<dt class="tm"><b>DESCRIPTION</b></dt>
<dd>The <code><b>wcb::checkStrForRegExp</b></code> callback checks whether
the string <code><i>str</i></code> to be inserted into the Tk or Ttk entry,
BWidget Entry, Tk or Ttk spinbox, or Ttk combobox widget
<code><i>w</i></code> is matched by the regular expression
<code><i>exp</i></code>; if not, it cancels the <code><b>insert</b></code>
operation.</dd>
<dd class="tm">The three other <code><b>wcb::checkStrFor*</b></code>
callbacks check whether the string <code><i>str</i></code> to be inserted
into the Tk or Ttk entry, BWidget Entry, Tk or Ttk spinbox, or Ttk
combobox widget <code><i>w</i></code> is alphabetic, numeric, or
alphanumeric, respectively; if not, they cancel the
<code><b>insert</b></code> operation. These procedures just invoke
the callback <code><b>wcb::checkStrForRegExp</b></code>, passing to it the
Unicode-based patterns <code>{^[[:alpha:]]*$}</code>,
<code>{^[[:digit:]]*$}</code>, and <code>{^[[:alnum:]]*$}</code>.</dd>
<dd class="tm">The <code><b>wcb::convStrTo*</b></code> callbacks replace
the string <code><i>str</i></code> to be inserted into the Tk or Ttk entry,
BWidget Entry, Tk or Ttk spinbox, or Ttk combobox widget
<code><i>w</i></code> with its uppercase or lowercase equivalent,
respectively.</dd>
<dd class="tm">The <code><b>wcb::checkEntryFor*</b></code> callbacks check
whether the text contained in the Tk or Ttk entry, BWidget Entry, Tk or Ttk
spinbox, or Ttk combobox widget <code><i>w</i></code> after inserting
the string <code><i>str</i></code> before the character indicated by the
index <code><i>idx</i></code> would represent (the starting part of) an
integer number, unsigned integer no greater than <code><i>max</i></code>,
real number, or real number in fixed-point format with at most
<code><i>cnt</i></code> digits after the decimal point, respectively; if
not, they cancel the <code><b>insert</b></code> operation.
<code><i>max</i></code> and <code><i>cnt</i></code> should be nonnegative
numbers or <code><b>*</b></code>; <code><i>max</i> =
<b>*</b></code> means: no upper bound for the Tk or Ttk entry,
BWidget Entry, Tk or Ttk spinbox, or Ttk combobox value, while
<code><i>cnt</i> = <b>*</b></code> stands for an unlimited number of
digits after the decimal point.</dd>
<dd class="tm">The <code><b>wcb::checkEntryLen</b></code> callback checks
whether the length of the text contained in the Tk or Ttk entry, BWidget
Entry, Tk or Ttk spinbox, or Ttk combobox widget <code><i>w</i></code>
after inserting the string <code><i>str</i></code> would be greater than
<code><i>len</i></code>; if yes, it cancels the <code><b>insert</b></code>
operation.</dd>
<dd class="tm">These callback procedures are implemented in the file
<code><b>wcbEntry.tcl</b></code>, contained in the
<code><b>scripts</b></code> directory. They return an empty
string.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>callback, insert, Tk entry, Ttk entry, BWidget Entry, Tk spinbox, Ttk
spinbox, Ttk combobox, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="textcb">Before-<code><b>insert</b></code> Callbacks for text and
ctext Widgets</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>wcb::checkStrsFor*</code>, <code>wcb::convStrsTo*</code> –
Before-<code><b>insert</b></code> callbacks for text and ctext widgets</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>wcb::checkStrsForRegExp</b> <i>exp w idx args</i>
<b>wcb::checkStrsForAlpha</b> <i> w idx args</i>
<b>wcb::checkStrsForNum</b> <i> w idx args</i>
<b>wcb::checkStrsForAlnum</b> <i> w idx args</i>
<b>wcb::convStrsToUpper</b> <i> w idx args</i>
<b>wcb::convStrsToLower</b> <i> w idx args</i>
</pre>
</dd>
<dt class="tm"><b>DESCRIPTION</b></dt>
<dd>The <code><b>wcb::checkStrsForRegExp</b></code> callback checks whether
the strings to be inserted into the text or ctext widget
<code><i>w</i></code>, contained in the list <code><i>args</i></code> of
the form <code><i>string</i> ?<i>tagList</i> <i>string</i>
<i>tagList</i> ...?</code>, are matched by the regular expression
<code><i>exp</i></code>; if not, it cancels the <code><b>insert</b></code>
operation.</dd>
<dd class="tm">The three other <code><b>wcb::checkStrsFor*</b></code>
callbacks check whether the strings to be inserted into the text or ctext
widget <code><i>w</i></code>, contained in the list
<code><i>args</i></code> of the form <code><i>string</i>
?<i>tagList</i> <i>string</i> <i>tagList</i> ...?</code>, are
alphabetic, numeric, or alphanumeric, respectively; if not, they cancel the
<code><b>insert</b></code> operation. These procedures just invoke
the callback <code><b>wcb::checkStrsForRegExp</b></code>, passing to it the
Unicode-based patterns <code>{^[[:alpha:]\n]*$}</code>,
<code>{^[[:digit:]\n]*$}</code>, and <code>{^[[:alnum:]\n]*$}</code>.</dd>
<dd class="tm">The <code><b>wcb::convStrsTo*</b></code> callbacks replace
the strings to be inserted into the text or ctext widget
<code><i>w</i></code>, contained in the list <code><i>args</i></code> of
the form <code><i>string</i> ?<i>tagList</i> <i>string</i>
<i>tagList</i> ...?</code>, with their uppercase or lowercase
equivalents, respectively.</dd>
<dd class="tm">These callback procedures are implemented in the file
<code><b>wcbText.tcl</b></code>, contained in the
<code><b>scripts</b></code> directory. They return an empty
string.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>callback, insert, text, ctext, widget</dd>
</dl>
<div align="center">
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
</body>
</html>
|