tokensearch::tokensearch
- Create and manipulate tokensearch widgetstokensearch::tokensearch pathName ?options?
-background or -bg
-borderwidth or -bd
-cursor
-exportselection
-font
-foreground or -fg
-highlightbackground
-highlightcolor
-highlightthickness
-insertbackground
-insertborderwidth
-insertofftime
-insertontime
-insertwidth
-padx
-pady
-relief
-selectbackground
-selectborderwidth
-selectforeground
-setgrid
-takefocus
-xscrollcommand
-yscrollcommand
-categories list
-categorybd pixels
-categorybg color
-categorycursor cursor
-categoryfont font
-categoryopts option_list
-categoryrelief relief
-dropdownheight numlines
-dropdownmaxheight numlines
-height numlines
-historyvar variable
-matchcase bool
-matchmode glob|regexp
-state normal|disabled
-tokenbg color
-tokenbordercolor color
-tokenfg color
-tokenselectbg color
-tokenselectfg color
-tokenselectbordercolor color
-tokenshape shape(s)
-tokenvar variable
-watermark text
-watermarkfg color
-width characters
-wrap bool
-background color
-bg color
-bordercolor color
-categoryindex indexList
-foreground color
-fg color
-selectbackground color
-selectbg color
-selectbordercolor color
-selectforeground color
-selectfg color
-shape shape(s)
-value text
pathName cget
option
pathName configure
?option? ?value option value ...?
pathName entryget
pathName entrytag
pathName listtag
pathName see
index
pathName tokencget
option
pathName tokenconfigure
?option? ?value option value ...?
pathName tokendelete
firstIndex ?lastIndex?
pathName tokenget
pathName tokenindex
name
pathName tokeninsert
index names
pathName tokenselection
option args
pathName tokenselection clear
firstIndex ?lastIndex
pathName tokenselection get
pathName tokenselection set
firstIndex ?lastIndex
pathName xview
args
pathName xview
pathName xview moveto fraction
pathName xview scroll number what
pathName yview
args
pathName yview
pathName yview moveto fraction
pathName yview scroll number what
tokensearch::tokensearch
- Create and manipulate tokensearch widgetstokensearch::tokensearch pathName ?options?
-background or -bg
-borderwidth or -bd
-exportselection
-font
-foreground or -fg
-highlightbackground
-highlightcolor
-highlightthickness
-insertbackground
-insertborderwidth
-insertofftime
-insertontime
-insertwidth
-padx
-pady
-relief
-selectbackground
-selectborderwidth
-selectforeground
-setgrid
-takefocus
-xscrollcommand
-yscrollcommand
Command-Line Name: | -categories |
Database Name: | categories |
Database Class: | Categories |
Specifies a variable which contains a specially formatted Tcl list containing the available search categories. The given variable must be a reference to a global variable.
The format of the list must be as follows. Each element of the list corresponds to a title and a list of associated categories. The title is not a selectable value in the category popup menu but it is used to help organize the categories. The list of associated categories are selectable by the user and will appear within the token when selected. This is also the category value that is returned with a call to the
tokenget
command and is the value that will populate the-tokenvar
list, is specified.For example, the following code will generate a list that looks like the following popup menu:
set categories {{Properties {Name Kind Label Tag}} {Other {All}}} tokensearch::tokensearch -categories $categories
Command-Line Name: | -categorybd |
Database Name: | categoryBorderWidth |
Database Class: | BorderWidth |
Specifies the width of the border to draw around the category popup menu in number of pixels. By default, the borderwidth is set to 1 pixel.
Command-Line Name: | -categorybg |
Database Name: | categoryBackground |
Database Class: | Background |
Specifies the color to use for the background of the category popup menu. By default, the background color is set to white.
Command-Line Name: | -categorycursor |
Database Name: | categoryCursor |
Database Class: | Cursor |
Specifies the cursor to use when the cursor enters the category popup menu area. The default cursor if the default cursor for the menu widget. See
Command-Line Name: | -categoryfont |
Database Name: | categoryFont |
Database Class: | Font |
Specifies the font to use for the category popup entries. The value may have any of the forms described in the font manual page.
Command-Line Name: | -categoryopts |
Database Name: | categoryOptions |
Database Class: | CategoryOptions |
Specifies a list of additional category options and their selection types. Category options are posted in the drop-down menu attached to the category portion of the token. They will be listed below all of the available categories in the menu. Each category option must be in the form of:
category_type value_list default_value
The value of category_type can be either "checkbutton" or "radiobutton". The value of value_list is the option name(s) that will be listed in the menu. The value of default_value is the default value for the option. In the case of a "checkbutton" option, the default value will be a boolean value. In the case of a "radiobutton" option, the default value will be a string matching one of the values in value_list.
For example, the following code will generate the following category drop-down menu:
set categories {{Properties {Name Kind Label Tag}}} set categoryopts {{checkbutton {Ignore Case} 1} {radiobutton {{Use regexp} {Use exact}} {Use regexp}}} tokensearch::tokensearch -categories $categories -categoryopts $categoryopts
Command-Line Name: | -categoryrelief |
Database Name: | categoryRelief |
Database Class: | Relief |
Specifies the 3-D effect desired for the category popup menu. Acceptable values are raised, sunken, flat, ridge, solid, and groove.
Command-Line Name: | -dropdownheight |
Database Name: | dropDownHeight |
Database Class: | DropDownHeight |
Specifies the number of text lines to display in the drop-down listbox that pops up when the user enters text into token entry text field. If the value is set to 0, the drop-down listbox will be set to the lesser of the number of elements in the
-historyvar
list or the value specified by-dropdownmaxheight
. By default, the drop-down height is set to a value of 0.
Command-Line Name: | -dropdownmaxheight |
Database Name: | dropDownMaxHeight |
Database Class: | DropDownMaxHeight |
If the value of
-dropdownheight
is set to a value of 0, this value determines the maximum number of lines that will be displayed in the drop-down listbox. By default, this value is set to 5.
Command-Line Name: | -height |
Database Name: | height |
Database Class: | Height |
Specifies the number of lines that can be displayed in the widget without scrolling. The widget does allow scrolling via the
-xscrollcommand
and-yscrollcommand
commands. By default, this is set to a value of 1.
Command-Line Name: | -historyvar |
Database Name: | historyVar |
Database Class: | HistoryVar |
Specifies a reference to a variable that contains search history information where each element is an individual search string. If this option is not specified, the tokensearch widget will use its own history list that will be destroyed when the widget is destroyed.
If there is existing history with the widget, any characters that are entered by the user which match elements in the history list cause those history elements to be displayed in the drop-down listbox. Additionally, if history is associated with the widget, the user can click the disclosure triangle in the value portion of the token to display a full history list associated with the widget. History matching can be controlled with the
-matchcase
and-matchmode
options.
Command-Line Name: | -matchcase |
Database Name: | matchCase |
Database Class: | MatchCase |
Specifies whether case matching should be used or not when matching the user-input string to the values in the
-values
list. This option should be set to a boolean value. By default, this option is set to false.
Command-Line Name: | -matchmode |
Database Name: | matchMode |
Database Class: | MatchMode |
Specifies the mode used to match the results of the user-entered text to the contents of the
-historyvar
list. The allowed values are: glob and regexp. If glob is specified, then glob-style pattern matching is used using the same rules as thestring match
command. If regexp is specified, then regular expression pattern matching is used using the rules described in there_syntax
reference page. By default, the match mode is set to glob.
Command-Line Name: | -state |
Database Name: | state |
Database Class: | State |
Specifies the current state of the widget: normal or disabled. If the widget state is normal the user may fully interact with the widget. If the state is disabled, the widget will be viewable only, but any interactions with the tokens or entry portion of the widget will be turned off.
Command-Line Name: | -tokenbg |
Database Name: | tokenBackground |
Database Class: | TokenBackground |
Specifies the color(s) to use for the background of the token when it is not selected. The value passed to this option can either be a one or two color list. If a one color list is used, the specified color is used for both the category and value portions of the widget. If a two color list is used, the first color is used for the category portion of the widget and the second color is used for the value portion of the widget.
Command-Line Name: | -tokenbordercolor |
Database Name: | tokenBorderColor |
Database Class: | TokenBorderColor |
Specifies the color(s) to use for the border of the token when it is not selected. The value passed to this option can either be a one or two color list. If a one color list is used, the specified color is used for both the category and value portions of the widget. If a two color list is used, the first color is used for the category portion of the widget and the second color is used for the value portion of the widget.
Command-Line Name: | -tokenfg |
Database Name: | tokenForeground |
Database Class: | TokenForeground |
Specifies the color(s) to use for the token text when the token is not selected. The value passed to this option can either be a one or two color list. If a one color list is used, the specified color is used for both the category and value portions of the widget. If a two color list is used, the first color is used for the category portion of the widget and the second color is used for the value portion of the widget.
Command-Line Name: | -tokenselectbg |
Database Name: | tokenSelectBackground |
Database Class: | TokenSelectBackground |
Specifies the color(s) to use for the background of the token when it is selected. The value passed to this option can either be a one or two color list. If a one color list is used, the specified color is used for both the category and value portions of the widget. If a two color list is used, the first color is used for the category portion of the widget and the second color is used for the value portion of the widget.
Command-Line Name: | -tokenselectbordercolor |
Database Name: | tokenSelectBorderColor |
Database Class: | TokenSelectBorderColor |
Specifies the color(s) to use for the border of the token when it is selected. The value passed to this option can either be a one or two color list. If a one color list is used, the specified color is used for both the category and value portions of the widget. If a two color list is used, the first color is used for the category portion of the widget and the second color is used for the value portion of the widget.
Command-Line Name: | -tokenselectfg |
Database Name: | tokenSelectForeground |
Database Class: | TokenSelectForeground |
Specifies the color(s) to use for the token text when the token is selected. The value passed to this option can either be a one or two color list. If a one color list is used, the specified color is used for both the category and value portions of the widget. If a two color list is used, the first color is used for the category portion of the widget and the second color is used for the value portion of the widget.
Command-Line Name: | -tokenshape |
Database Name: | tokenShape |
Database Class: | TokenShape |
Specifies shape(s) to use for the left and right side of the token. See the token
-shape
option for an explanation of the legal shape values and their usage.
Command-Line Name: | -tokenvar |
Database Name: | tokenVar |
Database Class: | TokenVar |
Specifies a variable in which the tokensearch widget will automatically store the token values when they are modified. The variable must reference a global variable.
Command-Line Name: | -watermark |
Database Name: | watermark |
Database Class: | Watermark |
Specifies a textual string that will be used as a watermark in the entry field. The watermark string cannot be copied or selected and only is visible when the entry field is empty. Once the user begins to type in the entry field, the watermark string is cleared and the user's input data is visible. By default, no watermark is displayed in the entry field. The watermark can be cleared by setting this option to the empty string.
Command-Line Name: | -watermarkfg |
Database Name: | watermarkForeground |
Database Class: | Foreground |
Specifies the foreground color to use when a watermark is to be displayed in the entry field.
Command-Line Name: | -width |
Database Name: | width |
Database Class: | Width |
Specifies the number of characters (based on the average character size of the currently assigned font) that can fit in the widget without wrapping. By default, the widget width is set to a value of 50.
Command-Line Name: | -wrap |
Database Name: | wrap |
Database Class: | Wrap |
Specifies whether line wrapping should be enabled (true) or disabled (false). If line wrapping is enabled, tokens and text will continue onto the next line (i.e., y-axis scrolling will be needed to view all tokens). Text will be wrapped on a word basis in this mode. If line wrapping is disabled, tokens will continue on the same line (i.e., x-axis scrolling will be needed to view all tokens). By default, this option will be set to false.
tokensearch::tokensearch
command creates a new window named
pathName
and of the class Tokensearch
and makes it
into a tokensearch widget. Additional options, described above, may be
specified on the command-line or in the option database to configure aspects of the
tokensearch sucah as its colors, font, and sizing. The
tokensearch::tokensearch
command returns its pathName
argument. At the time this command is invoked, there must not exist a window named
pathName
, but pathName
's parent must exist.
tokencget
and the tokenconfigure
commands:
-background color
-bg color
-bordercolor color
-categoryindex indexList
-categories
list. The value of
indexList
must contain two indices.
-foreground color
-fg color
-selectbackground color
-selectbg color
-selectbordercolor color
-selectforeground color
-selectfg color
-shape shape(s)
shape(s)
list can
contain one or two shape values. The legal values for shape(s)
are pill (large rounded corners), tag (angled corners), square
(squared corners), eased (slightly rounded corners), and ticket
(concave corners). If shape(s)
contains a single value, both the
left and right sides of the token will take on the given shape. If
shape(s)
contains two values, the first value refers to the shape
of the left side of the token and the second value refers to the shape of the right
side of the token.
tokensearch::tokensearch .te .te insert end foobar .te tokenconfigure 0 -shape pill
tokensearch::tokensearch .te .te insert end foobar .te tokenconfigure 0 -shape [list tag square]
-value text
tokensearch::tokensearch
command creates a new Tcl command whose
name is pathName
. This command may be used to invoke various
operations on the widget. It has the following general form:
pathName option ?arg arg ...?
option
and the arg
s determine the exact behavior
of the command. The following commands are possible for tokensearch widgets:
pathName cget option
pathName configure ?option? ?value option value ...?
pathName entryget
pathName entrytag
pathName listtag
pathName see index
pathName tokencget index option
pathName tokenconfigure index option value ?option value ...?
index
.
Returns the empty string. See TOKEN CONFIGURATION OPTIONS
for the available options.
pathName tokendelete firstIndex ?lastIndex?
lastIndex
is not specified, deletes the token at firstIndex
.
If lastIndex
is specified, deletes the tokens between
firstIndex
and lastIndex
, inclusive.
pathName tokenget
pathName tokenindex name
pathName tokeninsert index names
index
. The
names
is a list of token values to add. Tokens will be inserted such
that their order will be preserved in the listed order.
pathName tokenselection option args
option
:
pathName tokenselection clear firstIndex ?lastIndex?
lastIndex
is not specified, clears the selected token at the specified index.
If lastIndex
is specified, clears all of the tokens between firstIndex
and lastIndex
, inclusive.
pathName tokenselection get
pathName tokenselection set firstIndex ?lastIndex?
lastIndex
is not specified, selects the token specified at the given index.
If lastIndex
is specified, selects all of the tokens between firstIndex
and lastIndex
, inclusive.
pathName xview args
pathName xview
-xscrollcommand
option.
pathName xview moveto fraction
pathName xview scroll number what
pathName yview args
pathName yview
-yscrollcommand
option.
pathName yview moveto fraction
pathName yview scroll number what
-values
list (if this option has been
set to a list value). Any matches (as determined by the matching options) are
displayed in a drop-down listbox to allow the user to quickly select a token value.
Enter
key is pressed, the current text entered into the widget will
immediately be replaced with a token representing the textual value.
Enter
key is pressed, the
currently selected value in the drop-down listbox is used to create a token at the
current insertion point. If any non-tokenized text exists within the widget, it is
removed prior to the token being created for the selected value.
Tab
key is pressed, focus will be given to the next window in
the parent window of the widget. If any text has been entered into the widget, it is
immediately replaced with a token containing the text.
Down
key will change the selection
in the drop-down listbox to the value immediately below the currently selected value.
Additionally, the Up
key will will change the selection in the drop-down
listbox to the value immediately above the currently selected value.
Escape
key will hide the
drop-down listbox and return focus to the entry portion of the widget.
Control-x
(or
Command-x
on aqua-based windowing systems) will copy the selected text to
the clipboard and delete the selected text from the widget. If no text is currently
selected, the key binding will copy all of the non-tokenized text to the clipboard and
remove all non-tokenized text from the widget.
Control-c
(or
Command-x
on aqua-based windowing systems) will copy the selected text to
the clipboard. If no text is currently selected, the key binding will copy all of the
non-tokenized text to the clipboard.
Control-v
(or
Command-v
on aqua-based windowing systems) will paste the given string
information contained in the clipboard and insert it into the entry portion of the
widget. If the drop-down listbox is currently visible, it is hidden from view after
the paste operation.
Left
arrow key is pressed, the token to the left of the insertion cursor is
selected and given the focus.
Right
arrow key is pressed, the token to the right of the insertion cursor is
selected and given the focus.
-values
value is set to
a non-empty Tcl list, an arrow icon will be displayed to the right of the token text
to indicate that clicking on the arrow will display the drop-down list of all
available values. When the cursor leaves the token, the drop-down list arrow will
auto-hide. While the arrow is displayed, left-clicking the arrow will display the
drop-down listbox.
Delete
key will delete
the given token, set the focus to the entry widget, and set the insertion cursor to
the point in the entry widget where the token previously existed.
Control-x
(or Command-x
on
aqua-based windowing systems) will copy the token's value to the clipboard as a string and
the token will be deleted from the widget.
Control-c
(or Command-c
on
aqua-based windowing systems) will copy the token's value to the clipboard.
Right
or Left
key is pressed,
the token is deselected and the insertion cursor is moved to the right or left of the token.
Additionally, if the drop-down listbox is currently shown, it is automatically closed.
Down
key is pressed, the category and
category options menu is displayed and the focus is changed to the menu.
Shift-Down
keys are pressed, the history
drop-down listbox (if available) is displayed and the first item in the listbox is selected.
Escape
key will cause the history drop-down listbox to be closed.
Return
key is pressed, the token is removed, its text is inserted into the
text field in the same location, the text string is selected and focus is given to the
text field for immediate value editing.