The tokensearch Widget

by

Trevor Williams

phase1geo@gmail.com

Reference

NAME
tokensearch::tokensearch - Create and manipulate tokensearch widgets

SYNOPSIS
tokensearch::tokensearch pathName ?options?
STANDARD 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
WIDGET-SPECIFIC OPTIONS
-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
DESCRIPTION

TOKEN CONFIGURATION OPTIONS
-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
WIDGET COMMANDS

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
DEFAULT BINDINGS

DEFAULT TOKEN BINDINGS

KEYWORDS

Detailed Reference

NAME
tokensearch::tokensearch - Create and manipulate tokensearch widgets

SYNOPSIS
tokensearch::tokensearch pathName ?options?
STANDARD_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
See the options manual entry for details on the standard options.

WIDGET-SPECIFIC OPTIONS

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 the string match command. If regexp is specified, then regular expression pattern matching is used using the rules described in the re_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.

DESCRIPTION

The 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.

The tokensearch widget is a text widget that allows users to enter bits of text separated by commas or tabs and converts this text into a special window called a token. Each token consists of a category (left-portion of token) and a value (right-portion of token). Each token can be moved, deleted, modified or selected as a whole (i.e., the text within the token cannot be altered/handled on a character-by-character basis like a typical text field). Additionally, the category associated with the token can be modified via a popup menu accessible from the disclosure triangle in the category portion of the token. This type of widget is usually used for searching purposes (hence the name "tokensearch"), allowing the user to perform complex search operations via a graphical interface (i.e., no search "language" needs to be memorized).

The widget can be passed and maintain a history of search terms that can be accessed as the user enters characters into the entry field and after a token is created via the disclosure triangle in the value portion of the token.

TOKEN CONFIGURATION OPTIONS

The following options are currently supported by the tokencget and the tokenconfigure commands:
-background color
-bg color
Controls the color(s) used for the unselected token background for a specific token. 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.

-bordercolor color
Controls the color(s) of the border of a token when it is in the unselected state. 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.

-categoryindex indexList
Allows the user to change the category of the associated token using an index list that references the appropriate category name in the -categories list. The value of indexList must contain two indices.

-foreground color
-fg color
Controls the color(s) used for the unselected token foreground (i.e., text color) for a specific token. 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.

-selectbackground color
-selectbg color
Controls the color(s) used for the selected token background for a specific token. 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.

-selectbordercolor color
Controls the color(s) of the border of a token when it is in the selected state. 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.

-selectforeground color
-selectfg color
Controls the color(s) used for the selected token foreground (i.e., text color) for a specific token. 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.

-shape shape(s)
Specifies the shape to draw the tokens. The 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.
For example, the following creates a token whose left and right sides take on a pill shape:
  tokensearch::tokensearch .te
  .te insert end foobar
  .te tokenconfigure 0 -shape pill
The following example creates a token whose left side is in the shape of a tag while the right side is in the square shape:
  tokensearch::tokensearch .te
  .te insert end foobar
  .te tokenconfigure 0 -shape [list tag square]

-value text
Controls the search value that is displayed on the token.
WIDGET COMMANDS

The 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 args determine the exact behavior of the command.  The following commands are possible for tokensearch widgets:

pathName cget option
Retrieves the value of the given widget-specific option and returns it to the calling code. See STANDARD OPTIONS and WIDGET-SPECIFIC OPTIONS for the available options.

pathName configure ?option? ?value option value ...?
Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. See STANDARD OPTIONS and WIDGET-SPECIFIC OPTIONS for the available options.

pathName entryget
Returns any untokenized text currently in the widget.

pathName entrytag
Returns the name of a binding tag whose name depends on the path name of the tokensearch widget and which is associated with the tokensearch's entry field. This binding tag precedes the tag TokenSearchEntry in the list of binding tags of the tokensearch descendants mentioned above and is designed to be used when defining individual binding scripts for tokensearch widgets.

pathName listtag
Returns the name of a binding tag whose name depends on the path name of the tokensearch widget and which is associated with the tokensearch's dropdown list. This binding tag precedes the tag TokenSearchList in the list of binding tags of the tokensearch descendants mentioned above and is designed to be used when defining individual binding scripts for tokensearch widgets.

pathName see index
Adjusts the view in the window so that the character given by index is completely visible. If index is already visible then the command does nothing. If index is a short distance out of view, the command adjusts the view just enough to make index visible at the edge of the window. If index is far out of view, then the command centers index in the window.

pathName tokencget index option
Retrieves the value of the given token-specific option and returns it to the calling code. See TOKEN CONFIGURATION OPTIONS for the available options.

pathName tokenconfigure index option value ?option value ...?
Modifies the configuration option(s) of the token specified by index. Returns the empty string. See TOKEN CONFIGURATION OPTIONS for the available options.

pathName tokendelete firstIndex ?lastIndex?
If lastIndex is not specified, deletes the token at firstIndex. If lastIndex is specified, deletes the tokens between firstIndex and lastIndex, inclusive.

pathName tokenget
Returns a Tcl list containing all of the tokenized names within the widget. The list will be sorted in the same left-to-right order the tokens are currently listed in the widget.

pathName tokenindex name
Returns the numerical index of the token associated with the given token name.

pathName tokeninsert index names
Inserts new tokens into the widget at the specified token 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
This command is used to adjust the token selection within a tokensearch widget.  It has several forms, depending on option:
pathName tokenselection clear firstIndex ?lastIndex?
If 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
Returns the indices of all tokens that are currently selected as a list.

pathName tokenselection set firstIndex ?lastIndex?
If 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
This command is used to query and change the horizontal position of the information in the widget's window. It can take any of the following forms:
pathName xview
Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the horizontal span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the tokensearch's scrollable test is off-screen to the left, the middle 40% is visible in the window, and 40% of the scrollable text is off-screen to the right. The fractions refer only to the lines that are actually visible in the window: if the lines in the window are all very short, so that they are entirely visible, the returned fractions will be 0 and 1, even if there are other lines in the widget that are much wider than the window. These are the same values passed to scrollbars via the -xscrollcommand option.

pathName xview moveto fraction
Adjusts the view in the window so that fraction of the horizontal span of the widget is off-screen to the left. Fraction is a fraction between 0 and 1.

pathName xview scroll number what
This command shifts the view in the window left or right according to number and what. What must be units, pages or pixels. If what is units or pages then number must be an integer, otherwise number may be specified in any of the forms acceptable to Tk_GetPixels, such as "2.0c" or "1i" (the result is rounded to the nearest integer value. If no units are given, pixels are assumed). If what is units, the view adjusts left or right by number average-width characters on the display; if it is pages then the view adjusts by number screenfuls; if it is pixels then the view adjusts by number pixels. If number is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible.
pathName yview args
This command is used to query and change the vertical position of the elements in the widget's window. It can take any of the following forms:
pathName yview
Returns a list containing two elements, both of which are real fractions between 0 and 1. The first element gives the position of the first visible pixel of the first character (or token, etc) in the top line in the window, relative to the text as a whole (0.5 means it is halfway through the entry, for example). The second element gives the position of the first pixel just after the last visible one in the bottom line of the window, relative to the text as a whole. These are the same values passed to scrollbars via the -yscrollcommand option.
pathName yview moveto fraction
Adjusts the view in the window so that the pixel given by fraction appears at the top of the top line of the window. Fraction is a fraction between 0 and 1; 0 indicates the first pixel of the first character in the text, 0.33 indicates the pixel that is one-third the way through the text; and so on. Values close to 1 will indicate values close to the last pixel in the text (1 actually refers to one pixel beyond the last pixel), but in such cases the widget will never scroll beyond the last pixel, and so a value of 1 will effectively be rounded back to whatever fraction ensures the last pixel is at the bottom of the window, and some other pixel is at the top.
pathName yview scroll number what
This command adjust the view in the window up or down according to number and what. What must be units, pages or pixels. If what is units or pages then number must be an integer, otherwise number may be specified in any of the forms acceptable to Tk_GetPixels, such as ā€œ2.0cā€ or ā€œ1iā€ (the result is rounded to the nearest integer value. If no units are given, pixels are assumed). If what is units, the view adjusts up or down by number lines on the display; if it is pages then the view adjusts by number screenfuls; if it is pixels then the view adjusts by number pixels. If number is negative then earlier positions in the text become visible; if it is positive then later positions in the text become visible.
DEFAULT BINDINGS

The tokensearch widget contains several default bindings which are specified as follows:
  1. If a non-Return key is pressed, the current text within the widget is matched against the values specified in the -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.

  2. If the Enter key is pressed, the current text entered into the widget will immediately be replaced with a token representing the textual value.

  3. If the drop-down listbox is visible and the 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.

  4. If the 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.

  5. If the drop-down listbox is visible, the 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.

  6. If the drop-down listbox is visible, the Escape key will hide the drop-down listbox and return focus to the entry portion of the widget.

  7. If the drop-down listbox is visible, left-clicking the entry field will hide the drop-down listbox.

  8. If the drop-down listbox is visible, moving the mouse over the listbox will cause the selection to immediately reflect the position of the cursor. Clicking the left button when the cursor is hovering over an element in the listbox will automatically choose the given value, delete any existing non-tokenized text in the widget, and create a new token at the cursor insertion point with the selected value.

  9. When the widget loses focus, any non-tokenized text will be immediately converted to a token and inserted at the current insertion position.

  10. When the entry portion of the widget receives focus, 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.

  11. When the entry portion of the widget receives focus, 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.

  12. When the entry portion of the widget receives focus, 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.

  13. When the text field has focus and the insertion cursor is to the right of a token and the Left arrow key is pressed, the token to the left of the insertion cursor is selected and given the focus.

  14. When the text field has focus and the insertion cursor is to the left of a token and the the Right arrow key is pressed, the token to the right of the insertion cursor is selected and given the focus.

  15. Whenever a token is added, removed, modified or moved, the <<TokenSearchModified>> event is automatically generated.

  16. Clicking the left-button in the entry portion of the field positions the insertion cursor just before the character underneath the mouse cursor, sets the input focus to this widget, and clears any text selection in the widget. Dragging with mouse button 1 strokes out a selection between the insertion cursor and the character under the mouse.

  17. Double-clicking the left-button in the entry portion of the field selects the word under the mouse and positions the insertion cursor at the start of the word. Dragging after a double click will stroke out a selection consisting of whole words.

  18. Triple-clicking the left-button in the entry portion of the field selects the line under the mouse and positions the insertion cursor at the start of the line. Dragging after a triple click will stroke out a selection consisting of whole lines.

  19. The ends of the text selection can be adjusted by dragging with the left button while the Shift key is down; this will adjust the end of the selection that was nearest to the mouse when the left button was pressed. If the button id double-clicked before dragging then the selection will be adjusted in units of whole words; if it is triple-clicked then the selection will be adjusted in units of whole lines.

  20. Clicking the left button with the Control key down will reposition the insertion cursor without affecting the selection.

  21. The view in the widget can be adjusted by dragging with the middle mouse button. If the middle mouse button is clicked without moving the mouse, the selection is copied into the text at the position of the mouse cursor. The Insert key inserts the selection at the position of the insertion cursor.
  22. If the mouse is dragged out of the widget while the left button is pressed, the entry will automatically scroll to make more of the widget visible (if there is more text/tokens off-screen on the side where the mouse left the window).

  23. The left and right keys move the insertion cursor on character/token to th left or right; they also clear any text selection. If left or right is typed with the Shift key down, then the insertion cursor moves and the selection is extended to include the new character. Control-left and Control-right move the insertion cursor by words, and Control-Shift-left and Control-Shift-right move the insertion cursor by words and also extend the selection. Control-b and Control-f behave the same as left and right, respectively. Meta-b and Meta-f behave the same as Control-left and Control-right, respectively.

  24. The Home and Control-a keys move the insertion cursor to the beginning of its display line and clear any selection in the widget. Shift-Home moves the insertion cursor to the beginning of the display line and also extends the selection to that point.

  25. The End and Control-e keys move the insertion cursor to the end of the display line and clear any selection in the widget. Shift-End moves the cursor to the end of the display line and extends the selection to that point.

DEFAULT TOKEN BINDINGS

The individual tokens within the tokensearch widget have several default bindings which are the following:
  1. When a token is left-button pressed, it becomes available for a token move operation by closing the drop-down listbox (if visible) and giving the entry field focus so that the insertion cursor can be used to indicate where the token will be moved to if the token is moved. If the cursor is moved while the left-button is depressed, the cursor is changed to indicate where the token will be moved to when the left-button is released. When the left-button is released, the token is moved from the original position to the new position.

  2. If the button is not moved and the left-button is released, the token is selected if it currently is not selected or the selected token is detokenized (token is removed from the widget and its value is placed into the entry field at the same position, the text selected, and the entry given the focus for immediate editing).

  3. When the cursor enters the token and the -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.

  4. When a token is in the selected state, pressing the 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.

  5. When a token is in the selected state, 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.

  6. When a token is in the selected state, Control-c (or Command-c on aqua-based windowing systems) will copy the token's value to the clipboard.

  7. When a token is selected, the <> event is generated.

  8. When a token is selected and the 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.

  9. When a token is selected and the Down key is pressed, the category and category options menu is displayed and the focus is changed to the menu.
  10. When a token is selected and the Shift-Down keys are pressed, the history drop-down listbox (if available) is displayed and the first item in the listbox is selected.

  11. When a token is selected and the history drop-down listbox is displayed, pressing the Escape key will cause the history drop-down listbox to be closed.

  12. When a token is selected, the drop-down listbox is not displayed, and the 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.
KEYWORDS
token, entry, search, widget