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
|
'\"
'\" Generated from file 'tepam_argument_dialogbox\&.man' by tcllib/doctools with format 'nroff'
'\" Copyright (c) 2009-2013, Andreas Drollinger
'\"
.TH "tepam::argument_dialogbox" n 0\&.5\&.0 tcllib "Tcl's Enhanced Procedure and Argument Manager"
.\" The -*- nroff -*- definitions below are for supplemental macros used
.\" in Tcl/Tk manual entries.
.\"
.\" .AP type name in/out ?indent?
.\" Start paragraph describing an argument to a library procedure.
.\" type is type of argument (int, etc.), in/out is either "in", "out",
.\" or "in/out" to describe whether procedure reads or modifies arg,
.\" and indent is equivalent to second arg of .IP (shouldn't ever be
.\" needed; use .AS below instead)
.\"
.\" .AS ?type? ?name?
.\" Give maximum sizes of arguments for setting tab stops. Type and
.\" name are examples of largest possible arguments that will be passed
.\" to .AP later. If args are omitted, default tab stops are used.
.\"
.\" .BS
.\" Start box enclosure. From here until next .BE, everything will be
.\" enclosed in one large box.
.\"
.\" .BE
.\" End of box enclosure.
.\"
.\" .CS
.\" Begin code excerpt.
.\"
.\" .CE
.\" End code excerpt.
.\"
.\" .VS ?version? ?br?
.\" Begin vertical sidebar, for use in marking newly-changed parts
.\" of man pages. The first argument is ignored and used for recording
.\" the version when the .VS was added, so that the sidebars can be
.\" found and removed when they reach a certain age. If another argument
.\" is present, then a line break is forced before starting the sidebar.
.\"
.\" .VE
.\" End of vertical sidebar.
.\"
.\" .DS
.\" Begin an indented unfilled display.
.\"
.\" .DE
.\" End of indented unfilled display.
.\"
.\" .SO ?manpage?
.\" Start of list of standard options for a Tk widget. The manpage
.\" argument defines where to look up the standard options; if
.\" omitted, defaults to "options". The options follow on successive
.\" lines, in three columns separated by tabs.
.\"
.\" .SE
.\" End of list of standard options for a Tk widget.
.\"
.\" .OP cmdName dbName dbClass
.\" Start of description of a specific option. cmdName gives the
.\" option's name as specified in the class command, dbName gives
.\" the option's name in the option database, and dbClass gives
.\" the option's class in the option database.
.\"
.\" .UL arg1 arg2
.\" Print arg1 underlined, then print arg2 normally.
.\"
.\" .QW arg1 ?arg2?
.\" Print arg1 in quotes, then arg2 normally (for trailing punctuation).
.\"
.\" .PQ arg1 ?arg2?
.\" Print an open parenthesis, arg1 in quotes, then arg2 normally
.\" (for trailing punctuation) and then a closing parenthesis.
.\"
.\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
.\" # Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
. ie !"\\$2"" .TP \\n()Cu
. el .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1 \\fI\\$2\\fP (\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1 \\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
.\" # define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
.\" # BS - start boxed text
.\" # ^y = starting y location
.\" # ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
.\" # BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\" Draw four-sided box normally, but don't draw top of
.\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
.\" # VS - start vertical sidebar
.\" # ^Y = starting y location
.\" # ^v = 1 (for troff; for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
.\" # VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
.\" # Special macro to handle page bottom: finish off current
.\" # box/sidebar if in box/sidebar mode, then invoked standard
.\" # page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\" Draw three-sided box if this is the box's first page,
.\" draw two sides but no top otherwise.
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
.\" # DS - begin display
.de DS
.RS
.nf
.sp
..
.\" # DE - end display
.de DE
.fi
.RE
.sp
..
.\" # SO - start of list of standard options
.de SO
'ie '\\$1'' .ds So \\fBoptions\\fR
'el .ds So \\fB\\$1\\fR
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 5.5c 11c
.ft B
..
.\" # SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\*(So manual entry for details on the standard options.
..
.\" # OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name: \\fB\\$1\\fR
Database Name: \\fB\\$2\\fR
Database Class: \\fB\\$3\\fR
.fi
.IP
..
.\" # CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
.\" # CE - end code excerpt
.de CE
.fi
.RE
..
.\" # UL - underline word
.de UL
\\$1\l'|0\(ul'\\$2
..
.\" # QW - apply quotation marks to word
.de QW
.ie '\\*(lq'"' ``\\$1''\\$2
.\"" fix emacs highlighting
.el \\*(lq\\$1\\*(rq\\$2
..
.\" # PQ - apply parens and quotation marks to word
.de PQ
.ie '\\*(lq'"' (``\\$1''\\$2)\\$3
.\"" fix emacs highlighting
.el (\\*(lq\\$1\\*(rq\\$2)\\$3
..
.\" # QR - quoted range
.de QR
.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3
.\"" fix emacs highlighting
.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3
..
.\" # MT - "empty" string
.de MT
.QW ""
..
.BS
.SH NAME
tepam::argument_dialogbox \- TEPAM argument_dialogbox, reference manual
.SH SYNOPSIS
package require \fBTcl 8\&.3\fR
.sp
package require \fBTk 8\&.3\fR
.sp
package require \fBtepam ?0\&.5?\fR
.sp
\fBtepam::argument_dialogbox\fR \fIitem_name item_attributes ?item_name item_attributes? ?\&.\&.\&.?\fR
.sp
\fBtepam::argument_dialogbox\fR {\fIitem_name item_attributes ?item_name item_attributes? ?\&.\&.\&.?\fR}
.sp
.BE
.SH DESCRIPTION
.SH "ARGUMENT DIALOGBOX CALL"
The TEPAM \fBargument_dialogbox\fR is a flexible and easily usable data entry form generator that is available if Tk has been loaded\&. Each data entry element of a form is defined via a \fIdata entry item\fR that can be provided to \fBargument_dialogbox\fR in two formats:
.TP
\fBtepam::argument_dialogbox\fR \fIitem_name item_attributes ?item_name item_attributes? ?\&.\&.\&.?\fR
Using this first format, each \fIdata entry item\fR is defined via a pair of two arguments\&. The first one is the \fIitem name\fR that defines the entry widget that has to be used in the form\&. The second argument, called \fIitem attributes\fR, specifies the variable which is attributed to the data entry element as well as eventual formatting and context information\&.
.sp
The \fBargument_dialogbox\fR returns \fBok\fR if the entered data have been acknowledged (via the \fIOK\fR button) and validated by a data checker\&. If the entered data have been rejected (via the \fICancel\fR button) the \fBargument_dialogbox\fR returns \fBcancel\fR\&.
.sp
A small example illustrates how the \fBargument_dialogbox\fR can be employed:
.CS
set DialogResult [\fBtepam::argument_dialogbox\fR \\
\fB-title\fR "Itinerary selection" \\
\fB-file\fR {\fI-label "Itinerary report" -variable report_file\fR} \\
\fB-frame\fR {\fI-label "Itinerary start"\fR} \\
\fB-comment\fR {\fI-text "Specify your itinerary start location"\fR} \\
\fB-entry\fR {\fI-label "City" -variable start_city -type string\fR} \\
\fB-entry\fR {\fI-label "Street" -variable start_street -type string -optional 1\fR} \\
\fB-entry\fR {\fI-label "Street number" -variable start_street_nbr -type integer -optional 1\fR} \\
\fB-frame\fR {\fI-label "Itinerary destination"\fR} \\
\fB-comment\fR {\fI-text "Specify your itinerary destination"\fR} \\
\fB-entry\fR {\fI-label "City" -variable dest_city -type string\fR} \\
\fB-entry\fR {\fI-label "Street" -variable dest_street -type string -optional 1\fR} \\
\fB-entry\fR {\fI-label "Street number" -variable dest_street_nbr -type integer -optional 1\fR} \\
\fB-frame\fR {} \\
\fB-checkbutton\fR {\fI-label "Don't use highways" -variable no_highway\fR}]
.CE
.IP
This example opens a dialog box that has the title \fIItinerary selection\fR\&. A first entry widget in this box allows selecting a report file\&. It follows two frames to define respectively an itinerary start and end location\&. Each of these locations that are described with a comment has three entry widgets to specify respectively the city, street and the street number\&. Bellow the second frame there is a check button that allows specifying if eventual highways should be ignored\&.
.TP
\fBtepam::argument_dialogbox\fR {\fIitem_name item_attributes ?item_name item_attributes? ?\&.\&.\&.?\fR}
Sometimes it is simpler to provide all the data entry item definitions in form of a single list to \fBargument_dialogbox\fR, and not as individual arguments\&. The second format that is supported by \fBargument_dialogbox\fR corresponds exactly to the first one, except that all item definitions are packed into a single list that is provided to \fBargument_dialogbox\fR\&. The previous example can therefore also be written in the following way:
.CS
set DialogResult [\fBtepam::argument_dialogbox {\fR
\fB-title\fR "Itinerary selection"
\fB-file\fR {\fI-label "Itinerary report" -variable report_file\fR}
\&.\&.\&.
\fB-checkbutton\fR {\fI-label "Don't use highways" -variable no_highway\fR} \fB}\fR]
.CE
.PP
The commands \fBargument_dialogbox\fR as well as \fBprocedure\fR are exported from the namespace \fBtepam\fR\&. To use these commands without the \fBtepam::\fR namespace prefix, it is sufficient to import them into the main namespace:
.CS
\fBnamespace import tepam::*\fR
set DialogResult [\fBargument_dialogbox\fR \\
-title "Itinerary selection"
\&.\&.\&.
.CE
The following subsections explain the different argument item types that are accepted by the \fBargument_dialogbox\fR, classified into three groups\&. The first data entry item definition format will be used in the remaining document, knowing that this format can always be transformed into the second format by putting all arguments into a single list that is then provided to \fBargument_dialogbox\fR\&.
.SS "CONTEXT DEFINITION ITEMS"
The first item group allows specifying some context aspects of an argument dialog box\&. These items are taking a simple character string as item attribute:
.CS
tepam::argument_dialogbox \\
\fB-<argument_name>\fR \fIstring\fR \\
\&.\&.\&.
.CE
The following items are classified into this group:
.TP
-title \fIstring\fR
The dialog box window title which is by default \fIDialog\fR can be changed with the \fI-title\fR item:
.CS
tepam::argument_dialogbox \\
\fB-title\fR "System configuration" \\
\&.\&.\&.
.CE
.TP
-window \fIstring\fR
The argument dialog box uses by default \fI\&.dialog\fR as dialog top level window\&. This path can be changed with the \fI-window\fR item:
.CS
tepam::argument_dialogbox \\
\fB-window\fR \&.dialog \\
\&.\&.\&.
.CE
.TP
-parent \fIstring\fR
By defining a parent window, the argument dialog box will be displayed beside this one\&. Without explicit parent window definition, the top-level window will be considered as parent window\&.
.CS
tepam::argument_dialogbox \\
\fB-parent\fR \&.my_appl \\
\&.\&.\&.
.CE
.TP
-context \fIstring\fR
If a context is defined the dialog box state, e\&.g\&. the entered data as well as the window size and position, is restored the next time the argument dialog box is called\&. The assignment of a context allows saving the dialog box state in its context to distinguish between different usages of the argument dialog box\&.
.CS
tepam::argument_dialogbox \\
\fB-context\fR destination_definitions \\
\&.\&.\&.
.CE
.PP
.SS "FORMATTING AND DISPLAY OPTIONS"
Especially for big, complex forms it becomes important that the different data entry widgets are graphically well organized and commented to provide an immediate and clear overview to the user\&. A couple of items allow structuring and commenting the dialog boxes\&.
.PP
The items of this classification group require as item attributes a definition list, which contains itself attribute name and value pairs:
.CS
tepam::argument_dialogbox \\
\&.\&.\&.
\fB-<argument_name>\fR { \fI
?-<attribute_name> <attribute_value>?
?-<attribute_name> <attribute_value>?
?\&.\&.\&.?\fR
}
\&.\&.\&.
.CE
The following items are classified into this group:
.TP
-frame \fIlist\fR
The \fI-frame\fR item allows packing all following entry widgets into a labeled frame, until a next frame item is defined or until the last entry widget has been defined\&. It recognizes the following attributes inside the item attribute list:
.RS
.TP
-label \fIstring\fR
An optional frame label can be specified with the \fI-label\fR statement\&.
.RE
.IP
Example:
.CS
tepam::argument_dialogbox \\
\&.\&.\&.
\fB-frame\fR {\fI-label "Destination address"\fR}
\&.\&.\&.
.CE
.IP
To close an open frame without opening a new one, an empty list has to be provided to the \fI-frame\fR statement\&.
.CS
tepam::argument_dialogbox \\
\&.\&.\&.
\fB-frame\fR {}
\&.\&.\&.
.CE
.TP
-sep [const {{}}]
Entry widgets can be separated with the \fI-sep\fR statement which doesn't require additional definitions\&. The related definition list has to exist, but its content is ignored\&.
.CS
tepam::argument_dialogbox \\
\&.\&.\&.
\fB-sep\fR {}
\&.\&.\&.
.CE
.TP
-comment \fIstring\fR
Comments and descriptions can be added with the \fI-text\fR attribute of the \fI-comment\fR item\&. Please note that each entry widget itself can also contain a \fI-text\fR attribute for comments and descriptions\&. But the \fI-comment\fR item allows for example adding a description between two frames\&.
.CS
tepam::argument_dialogbox \\
\&.\&.\&.
\fB-comment\fR {\fI-text "Specify bellow the destination address"\fR}
\&.\&.\&.
.CE
.TP
-yscroll \fB0\fR|\fB1\fR|\fBauto\fR
This attribute allows controlling an eventual vertical scrollbar\&. Setting it to \fB0\fR will permanently disable the scrollbar, setting it to \fB1\fR will enable it\&. By default it is set to \fBauto\fR\&. The scrollbar is enabled in this mode only if the vertical data entry form size exceeds 66% of the screen height\&.
.CS
tepam::argument_dialogbox \\
\&.\&.\&.
\fB-yscroll\fR \fBauto\fR
\&.\&.\&.
.CE
.PP
.SS "GLOBAL CUSTOM DATA VALIDATION"
This item group allows specifying global custom checks to validate the entered data\&.
.TP
-validatecommand \fIscript\fR
Custom data checks can be performed via validation commands that are defined with the \fI-validatecommand\fR item\&. Example:
.CS
tepam::argument_dialogbox \\
-entry {-label "Your comment" -variable YourCom} \\
\fB-validatecommand\fR {IllegalWordDetector $YourCom}
.CE
.IP
The validation command is executed in the context of the calling procedure, once all the basic data checks have been performed and data variables are assigned\&. All data is accessed via the data variables\&. Note that there is also an entry widget specific attribute \fI-validatecommand\fR that allows declaring custom checks for specific data entries\&.
.sp
The attribute \fI-validatecommand\fR can be repeated to declare multiple custom checks\&.
.TP
-validatecommand_error_text \fIstring\fR
This item allows overriding the default error message for a global custom argument validation (defined by \fI-validatecommand\fR)\&. Also this attribute can be repeated in case multiple checks are declared\&.
.TP
-validatecommand2 \fIscript\fR
.TP
-validatecommand2_error_text \fIstring\fR
These items are mainly for TEPAM internal usage\&.
.sp
These items corrspond respectively to \fI-validatecommand\fR and \fI-validatecommand_error_text\fR\&. However, the data validation is not performed in the next upper stack level, but two stack levels higher\&.
.PP
.SS "DATA ENTRY WIDGET ITEMS"
Data entry widgets are created with the widget items\&. These items require as item attributes a definition list, which contains itself attribute name and value pairs:
.CS
tepam::argument_dialogbox \\
\&.\&.\&.
\fB-<argument_name>\fR { \fI
?-<attribute_name> <attribute_value>?
?-<attribute_name> <attribute_value>?
?\&.\&.\&.?\fR
}
\&.\&.\&.
.CE
The attribute list can contain various attributes to describe and comment an entry widget and to constrain its entered value\&. All entry widgets are accepting a common set of attributes that are described in the section \fBEntry Widget Item Attributes\fR\&.
.PP
TEPAM defines a rich set of entry widgets\&. If necessary, this set can be extended with additional application specific entry widgets (see \fBAPPLICATION SPECIFIC ENTRY WIDGETS\fR):
.TP
-entry \fIlist\fR
The \fI-entry\fR item generates the simplest but most universal data entry widget\&. It allows entering any kind of data in form of single line strings\&.
.CS
tepam::argument_dialogbox \\
\fB-entry\fR {-label Name -variable Entry}
.CE
.TP
-text \fIlist\fR
The \fI-text\fR item generates a multi line text entry widget\&. The widget height can be selected with the \fI-height\fR attribute\&.
.CS
tepam::argument_dialogbox \\
\fB-text\fR {-label Name -variable Text -height 5}
.CE
.TP
-checkbox \fIlist\fR
A group of check boxes is created with the \fI-checkbox\fR item\&. The number of check boxes and their option values are specified with a list assigned to the \fI-choices\fR attribute or via a variable declared with the \fI-choicevariable\fR attribute:
.CS
tepam::argument_dialogbox \\
\fB-checkbox\fR {-label "Font sytle" -variable FontStyle \\
-choices {bold italic underline} -default italic}
.CE
.IP
If the labels of the check boxes should differ from the option values, their labels can be defined with the \fI-choicelabels\fR attribute:
.CS
tepam::argument_dialogbox \\
\fB-checkbox\fR {-label "Font sytle" -variable FontStyle \\
-choices {bold italic underline} \\
-choicelabels {Bold Italic Underline} \\
-default italic}
.CE
.IP
In contrast to a radio box group, a check box group allows selecting simultaneously several choice options\&. The selection is stored for this reason inside the defined variable in form of a list, even if only one choice option has been selected\&.
.TP
-radiobox \fIlist\fR
A group of radio boxes is created with the \fI-radiobox\fR item\&. The number of radio boxes and their option values are specified with a list assigned to the \fI-choices\fR attribute or via a variable declared with the \fI-choicevariable\fR attribute\&.
.sp
In contrast to a check box group, a radio box group allows selecting simultaneously only one choice option\&. The selected option value is stored directly, and not in form of a list, inside the defined variable\&.
.CS
tepam::argument_dialogbox \\
\fB-radiobox\fR {-label "Text adjustment" -variable Adjustment \\
-choices {left center right} -default left}
.CE
.IP
If the labels of the radio boxes should differ from the option values, their labels can be defined with the \fI-choicelabels\fR attribute:
.CS
tepam::argument_dialogbox \\
\fB-radiobox\fR {-label "Text adjustment" -variable Adjustment \\
-choices {left center right} \\
-choicelabels {Left Center Right} -default left}
.CE
.TP
-checkbutton \fIlist\fR
The \fI-checkbutton\fR entry widget allows activating or deactivating a single choice option\&. The result written into the variable will either be \fB0\fR if the check button was not activated or \fB1\fR if it was activated\&. An eventually provided default value has also to be either \fB0\fR or \fB1\fR\&.
.CS
tepam::argument_dialogbox \\
\fB-checkbutton\fR {-label Capitalize -variable Capitalize -default 1}
.CE
.PP
Several types of list and combo boxes are available to handle selection lists\&.
.TP
-combobox \fIlist\fR
The combobox is a combination of a normal entry widget together with a drop-down list box\&. The combobox allows selecting from this drop-down list box a single element\&. The list of the available elements can be provided either as a list to the \fI-choices\fR attribute, or via a variable that is specified with the \fI-choicevariable\fR attribute\&.
.CS
tepam::argument_dialogbox \\
\fB-combobox\fR {-label "Text size" -variable Size -choices {8 9 10 12 15 18} -default 12}
.CE
.IP
And here is an example of using a variable to define the selection list:
.CS
set TextSizes {8 9 10 12 15 18}
tepam::argument_dialogbox \\
\fB-combobox\fR {-label "Text size" -variable Size -choicevariable TextSizes -default 12}
.CE
.TP
-listbox \fIlist\fR
In contrast to the combo box, the list box is always displayed by the \fIlistbox\fR entry widget\&. Only one element is selectable unless the \fI-multiple_selection\fR attribute is set\&. The list box height can be selected with the \fI-height\fR attribute\&. If the height is not explicitly defined, the list box height is automatically adapted to the argument dialog box size\&.
The first example uses a variable to define the available choices:
.CS
set set AvailableSizes
for {set k 0} {$k<16} {incr k} {lappend AvailableSizes [expr 1<<$k]}
tepam::argument_dialogbox \\
\fB-listbox\fR {-label "Distance" -variable Distance \\
-choicevariable AvailableSizes -default 6 -height 5}
.CE
.IP
Here is a multi-element selection example\&. Please note that also the default selection can contain multiple elements:
.CS
tepam::argument_dialogbox \\
\fB-listbox\fR {-label "Text styles" -variable Styles \\
-choices {bold italic underline overstrike} \\
-choicelabels {Bold Italic Underline Overstrike} \\
-default {bold underline} -multiple_selection 1 \\
-height 3}
.CE
.TP
-disjointlistbox \fIlist\fR
A disjoint list box has to be used instead of a normal list box if the selection order is important\&. The disjoint list box entry widget has in fact two list boxes, one to select elements and one to display the selected elements in the chosen order\&.
.sp
Disjoint listboxes allow always selecting multiple elements\&. With the exception of the \fI-multiple_selection\fR attribute, disjointed list boxes are accepting the same attributes as the normal listbox, e\&.g\&. \fI-height, -choices, -choicevariable, -default\fR\&.
.CS
tepam::argument_dialogbox \\
\fB-disjointlistbox\fR {-label "Preferred scripting languages" -variable Languages \\
-comment "Please select your preferred languages in the order" \\
-choices {JavaScript Lisp Lua Octave PHP Perl Python Ruby Scheme Tcl} \\
-default {Tcl Perl Python}}
.CE
.PP
The file and directory selectors are building a next group of data entry widgets\&. A paragraph of section \fBEntry Widget Item Attributes\fR explains the widget specific attributes that allow specifying the targeted file types, active directory etc\&.
.TP
-file \fIlist\fR
The item \fI-file\fR creates a group composed by an entry widget together with a button that allows opening a file browser\&. The data type \fIfile\fR is automatically selected for this entry if no data type has been explicitly defined with the \fI-type\fR attribute\&.
.CS
tepam::argument_dialogbox \\
\fB-file\fR {-label "Image file" -variable ImageF \\
-filetypes {{"GIF" {*\&.gif}} {"JPG" {*\&.jpg}}} \\
-initialfile "picture\&.gif"}
.CE
.TP
-existingfile \fIlist\fR
The item \fI-existingfile\fR creates a group composed by an entry widget together with a button that allows opening a browser to select an existing file\&. The data type \fIexistingfile\fR is automatically selected for this entry if no data type has been explicitly defined with the \fI-type\fR attribute\&.
.CS
tepam::argument_dialogbox \\
\fB-existingfile\fR {-label "Image file" -variable ImageF \\
-filetypes {{"GIF" {*\&.gif}} {"JPG" {*\&.jpg}}} \\
-initialfile "picture\&.gif"}
.CE
.TP
-directory \fIlist\fR
The item \fI-directory\fR creates a group composed by an entry widget together with a button that allows opening a directory browser\&. The data type \fIdirectory\fR is automatically selected for this entry if no data type has been explicitly defined with the \fI-type\fR attribute\&.
.CS
tepam::argument_dialogbox \\
\fB-directory\fR {-label "Report directory" -variable ReportDir}
.CE
.TP
-existingdirectory \fIlist\fR
The item \fI-existingdirectory\fR creates a group composed by an entry widget together with a button that allows opening a browser to select an existing directory\&. The data type \fIexistingdirectory\fR is automatically selected for this entry if no data type has been explicitly defined with the \fI-type\fR attribute\&.
.CS
tepam::argument_dialogbox \\
\fB-existingdirectory\fR {-label "Report directory" -variable ReportDir}
.CE
.PP
Finally, there is a last group of some other special data entry widgets\&.
.TP
-color \fIlist\fR
The color selector is composed by an entry widget together with a button that allows opening a color browser\&. The data type \fIcolor\fR is automatically selected for this entry widget type if no data type has been explicitly defined with the \fI-type\fR attribute\&.
.CS
tepam::argument_dialogbox \\
\fB-color\fR {-label "Background color" -variable Color -default red}
.CE
.TP
-font \fIlist\fR
The font selector is composed by an entry widget together with a button that allows opening a font browser\&. The data type \fIfont\fR is automatically selected for this entry widget type if no data type has been explicitly defined with the \fI-type\fR attribute\&. The entry widget displays an example text in the format of the selected font\&.
.sp
The font browser allows selecting by default the font families provided by the \fBfont families\fR Tk command as well as a reasonable set of different font sizes between 6 points and 40 points\&. Different sets of font families and font sizes can be specified respectively via the \fI-font_families\fR or \fI-font_sizes\fR attributes\&.
.sp
If no default font is provided via the \fI-default\fR attribute, the default font of the label widget to display the selected font will be used as default selected font\&. If the font family of this label widget is not part of the available families the first available family is used as default\&. If the font size of this label widget is not part of the available sizes the next close available size is selected as default size\&.
.CS
tepam::argument_dialogbox \\
\fB-font\fR {-label "Font" -variable Font \\
-font_sizes {8 10 12 16} \\
-default {Arial 20 italic}}
.CE
.PP
.SS "ENTRY WIDGET ITEM ATTRIBUTES"
All the entry widget items are accepting the following attributes:
.TP
-text \fIstring\fR
Eventual descriptions and comments specified with the \fI-text\fR attribute are displayed above the entry widget\&.
.CS
tepam::argument_dialogbox \\
-entry {\fB-text "Please enter your name bellow"\fR -variable Name}
.CE
.TP
-label \fIstring\fR
The label attribute creates left to the entry widget a label using the provided string as label text:
.CS
tepam::argument_dialogbox \\
-entry {\fB-label Name\fR -variable Name}
.CE
.TP
-variable \fIstring\fR
All entry widgets require a specified variable\&. After accepting the entered information with the OK button, the entry widget data is stored inside the defined variables\&.
.CS
tepam::argument_dialogbox \\
-existingdirectory {-label "Report directory" \fB-variable ReportDir\fR}
.CE
.TP
-default \fIstring\fR
Eventual default data for the entry widgets can be provided via the \fI-default\fR attribute\&. The default value is overridden if an argument dialog box with a defined context is called another time\&. The value acknowledged in a previous call will be used in this case as default value\&.
.CS
tepam::argument_dialogbox \\
-checkbox {-label "Font sytle" -variable FontStyle \\
-choices {bold italic underline} \fB-default italic\fR}
.CE
.TP
-optional \fB0\fR|\fB1\fR
Data can be specified as optional or mandatory with the \fI-optional\fR attribute that requires either \fB0\fR (mandatory) or \fB1\fR (optional) as attribute data\&.
.sp
In case an entry is optional and no data has been entered, e\&.g\&. the entry contains an empty character string, the entry will be considered as undefined and the assigned variable will not be defined\&.
.CS
tepam::argument_dialogbox \\
-entry {-label "City" -variable start_city -type string} \\
-entry {-label "Street" -variable start_street -type string \fB-optional 0\fR} \\
-entry {-label "Street number" -variable start_street_nbr -type integer \fB-optional 1\fR} \\
.CE
.TP
-type \fIstring\fR
If the data type is defined with the \fI-type\fR attribute the argument dialog box will automatically perform a data type check after acknowledging the entered values and before the dialog box is closed\&. If a type incompatible value is found an error message box appears and the user can correct the value\&.
.sp
The argument dialog box accepts all types that have been specified by the TEPAM package and that are also used by \fBtepam::procedure\fR (see the \fItepam::procedure reference manual\fR)\&.
.sp
Some entry widgets like the file and directory widgets, as well as the color and font widgets are specifying automatically the default data type if no type has been specified explicitly with the \fI-type\fR attribute\&.
.CS
tepam::argument_dialogbox \\
\fB-entry\fR {-label "Street number" -variable start_street_nbr \fB-type integer\fR} \\
.CE
.TP
-range \fIstring\fR
Values can be constrained with the \fI-range\fR attribute\&. The valid range is defined with a list containing the minimum valid value and a maximum valid value\&.
.sp
The \fI-range\fR attribute has to be used only for numerical arguments, like integers and doubles\&.
.CS
tepam::argument_dialogbox \\
-entry {-label Month -variable Month -type integer \fB-range {1 12}\fR}
.CE
.TP
-validatecommand \fIstring\fR
Custom argument value validations can be performed via specific validation commands that are defined with the \fI-validatecommand\fR attribute\&. The provided validation command can be a complete script in which the pattern \fI%P\fR is placeholder for the argument value that has to be validated\&.
.CS
tepam::argument_dialogbox \\
-entry {-label "Your comment" -variable YourCom \\
\fB-validatecommand\fR "IllegalWordDetector %P"}
.CE
.IP
While the purpose of this custom argument validation attribute is the validation of a specific argument, there is also a global data validation attribute \fI-validatecommand\fR that allows performing validation that involves multiple arguments\&.
.TP
-validatecommand_error_text \fIstring\fR
This attribute allows overriding the default error message for a custom argument validation (defined by \fI-validatecommand\fR)\&.
.PP
Some other attributes are supported by the list and combo boxes as well as by the radio and check buttons\&.
.TP
-choices \fIstring\fR
Choice lists can directly be defined with the \fI-choices\fR attribute\&. This way to define choice lists is especially adapted for smaller, fixed selection lists\&.
.CS
tepam::argument_dialogbox \\
-listbox {-label "Text styles" -variable Styles \\
\fB-choices {bold italic underline}\fR -default underline
.CE
.TP
-choicelabels \fIstring\fR \fI(only check and radio buttons)\fR
If the labels of the check and radio boxes should differ from the option values, they can be defined with the \fI-choicelabels\fR attribute:
.CS
tepam::argument_dialogbox \\
-checkbox {-label "Font sytle" -variable FontStyle \\
-choices {bold italic underline} \\
\fB-choicelabels {Bold Italic Underline}\fR
.CE
.TP
-choicevariable \fIstring\fR
Another way to define the choice lists is using the \fI-choicevariable\fR attribute\&. This way to define choice lists is especially adapted for huge and eventually variable selection lists\&.
.CS
set TextSizes {8 9 10 12 15 18}
tepam::argument_dialogbox \\
-combobox {-label "Text size" -variable Size \fB-choicevariable TextSizes\fR}
.CE
.TP
-multiple_selection \fB0\fR|\fB1\fR
The list box item (\fB-listbox\fR) allows by default selecting only one list element\&. By setting the \fI-multiple_selection\fR attribute to \fB1\fR, multiple elements can be selected\&.
.CS
tepam::argument_dialogbox \\
-listbox {-label "Text styles" -variable Styles \\
-choices {bold italic underline} -default underline \\
\fB-multiple_selection 1\fR -height 3}
.CE
.PP
Some additional attributes are supported by the file and directory selection widgets\&.
.TP
-filetypes \fIstring\fR
The file type attribute is used by the \fB-file\fR and \fB-existingfile\fR items to define the file endings that are searched by the file browser\&.
.CS
tepam::argument_dialogbox \\
-file {-label "Image file" -variable ImageF \\
\fB-filetypes {{"GIF" {*\&.gif}} {"JPG" {*\&.jpg}}}\fR}
.CE
.TP
-initialfile \fIstring\fR
The initial file used by the file browsers of the \fB-file\fR and \fB-existingfile\fR widgets are by default the file defined with the \fI-default\fR attribute, unless a file is specified with the \fI-initialfile\fR attribute\&.
.CS
tepam::argument_dialogbox \\
-file {-variable ImageF \fB-initialfile "picture\&.gif"\fR}
.CE
.TP
-activedir \fIstring\fR
The \fI-activedir\fR attribute will override the default active search directory used by the file browsers of all file and directory entry widgets\&. The default active search directory is defined by the directory of a specified initial file (\fI-initialfile\fR) if defined, and otherwise by the directory of the default file/directory, specified with the \fI-default\fR attribute\&.
.CS
tepam::argument_dialogbox \\
-file "-variable ImageF \fB-activedir $pwd\fR"
.CE
.PP
Finally, there is a last attribute supported by some widgets:
.TP
-height \fIstring\fR
All widgets containing a selection list (\fB-listbox\fR, \fB-disjointlistbox\fR, \fB-font\fR) as well as the multi line \fB-text\fR widget are accepting the \fI-height\fR attribute that defines the number of displayed rows of the selection lists\&.
.CS
tepam::argument_dialogbox \\
-listbox {-label "Text size" -variable Size \\
-choices {8 9 10 12 15 18} -default 12 \fB-height 3\fR}
.CE
.IP
If the no height has been explicitly specified the height of the widget will be dynamically adapted to the argument dialog box size\&.
.PP
.SH "APPLICATION SPECIFIC ENTRY WIDGETS"
An application specific entry widget can be made available to the argument dialog box by adding a dedicated procedure to the \fBtepam\fR namespace\&. This procedure has three arguments; the first one is the widget path, the second one a subcommand and the third argument has various purposes:
.CS
\fIproc\fR tepam::ad_form(<WidgetName>) {W Command {Par ""}} {
\fIupvar Option Option; # if required\fR
\fIvariable argument_dialogbox; # if required\fR
switch $Command {
"create" <CreateCommandSequence>
"set_choice" <SetChoiceCommandSequence>
"set" <SetCommandv>
"get" <GetCommandSequence>
}
}
.CE
\fBArgument_dialogbox\fR takes care about the \fI-label\fR and \fI-text\fR attributes for all entry widgets\&. For any data entry widget it creates a frame into which the data entry widget components can be placed\&. The path to this frame is provided via the \fIW\fR argument\&.
.PP
The entry widget procedure has to support 3 mandatory and an optional command that are selected via the argument \fICommand\fR:
.TP
\fIcreate\fR
The entry widget is called a first time with the command \fIcreate\fR to build the data entry widget\&.
.sp
The frames that are made available by \fBargument_dialogbox\fR for the entry widgets are by default only extendable in the X direction\&. To make them also extendable in the Y direction, for example for extendable list boxes, the command \fBad_form(make_expandable) $W\fR has to be executed when an entry widget is built\&.
.TP
\fIset_choice\fR
The entry widget procedure is only called with the \fIset_choice\fR command if the \fI-choices\fR or \fI-choicevariable\fR has been specified\&. The command is therefore only relevant for list and combo boxes\&.
.sp
The available selection list that is either specified with the \fI-choices\fR or \fI-choicevariable\fR attribute is provided via the \fIPar\fR argument to the entry widget procedure\&. This list can be used to initialize an available choice list\&.
.TP
\fIset\fR
If a default value is either defined via the \fI-default\fR attribute or via a preceding call the entry widget procedure is called with the \fIset\fR command\&. The argument \fIPar\fR contains in this case the value to which the entry widget has to be initialized\&.
.TP
\fIget\fR
The entry widget procedure command \fIget\fR has to return the current value of the entry widget\&.
.PP
Eventually specified entry widget item attributes are available via the \fBOption\fR array variable of the calling procedure\&. This variable becomes accessible inside the entry widget procedure via the \fBupvar\fR command\&.
.PP
There may be a need to store some information in a variable\&. The array variable \fBargument_dialogbox\fR has to be used for this purpose together with array indexes starting with \fI"$W,"\fR, e\&.g\&. \fIargument_dialogbox($W,values)\fR\&.
.PP
Examples of entry widget procedures are directly provided by the TEPAM package source file that specifies the standard entry widget procedures\&. The simplest procedure is the one for the basic \fIentry\fR widget:
.CS
proc tepam::ad_form(entry) {W Command {Par ""}} {
switch $Command {
"create" {pack [entry \\$W\&.entry] -fill x \\
-expand yes -pady 4 -side left}
"set" {\\$W\&.entry insert 0 $Par}
"get" {return [\\$W\&.entry get]}
}
}
.CE
It is also possible to relay on an existing entry widget procedure to derive a new, more specific one\&. The \fIradiobox\fR widget is used for example, to create a new entry widget that allows selecting either \fIleft\fR, \fIcenter\fR or \fIright\fR\&. The original \fIradiobox\fR widget is called with the \fIset_choice\fR command immediately after the \fIcreate\fR command, to define the fixed list of selection options\&.
.CS
proc tepam::ad_form(rcl) {W Command {Par ""}} {
set Res [ad_form(radiobox) $W $Command $Par]
if {$Command=="create"} {
ad_form(radiobox) $W set_choice {left center right}
}
return $Res
}
.CE
Please consult the TEPAM package source file to find additional and more complex examples of entry widget procedures\&.
.SH VARIABLES
The \fBargument_dialogbox\fR is using two variables inside the namespace \fB::tepam\fR:
.TP
\fBargument_dialogbox\fR
Application specific entry widget procedures can use this array variable to store their own data, using as index the widget path provided to the procedure, e\&.g\&. \fIargument_dialogbox($W,<sub_index>)\fR\&.
.TP
\fBlast_parameters\fR
This array variable is only used by an argument dialog box if its context has been specified via the \fI-context\fR attribute\&. The argument dialog box position and size as well as its entered data are stored inside this variable if the data are acknowledged and the form is closed\&. This allows the form to restore its previous state once it is called another time\&.
.sp
To reuse the saved parameters not just in the actual application session but also in another one, it is sufficient to store the \fBlast_parameter\fR array variable contents in a configuration file which is loaded the next time an application is launched\&.
.PP
.SH "SEE ALSO"
tepam(n), tepam::procedure(n)
.SH KEYWORDS
data entry form, parameter entry form
.SH CATEGORY
Argument entry form, mega widget
.SH COPYRIGHT
.nf
Copyright (c) 2009-2013, Andreas Drollinger
.fi
|