iwidgets::entryfield(1)

โœจ iwidgets::entryfield โœจ

okay bestie, welcome to the manual page for iwidgets::entryfield, part of [incr Widgets]. this is the girlies' guide to making an entry field widget, and yes she's the upgraded version. ๐Ÿ’…


NAME

iwidgets::entryfield โ€” create and manipulate a entry field widget ๐ŸŽ€


SYNOPSIS

iwidgets::entryfield pathName ?options?

that's it. that's the whole summoning ritual. ๐Ÿ’–


INHERITANCE

she comes from a whole lineage, and the family tree goes like this:

itk::Widget <- iwidgets::LabeledWidget <- iwidgets::Entryfield

so she inherits from iwidgets::LabeledWidget, which inherits from itk::Widget. iconic bloodline honestly. ๐Ÿ‘‘


STANDARD OPTIONS

these are the classics, the everyday slays:

  • background
  • borderWidth
  • cursor
  • exportSelection
  • foreground
  • highlightColor
  • highlightThickness
  • insertBackground
  • insertBorderWidth
  • insertOffTime
  • insertOnTime
  • insertWidth
  • justify
  • relief
  • selectBackground
  • selectBorderWidth
  • selectForeground
  • textVariable
  • width
See the options manual entry for details on the standard options. that's where the lore lives. ๐Ÿ“–

ASSOCIATED OPTIONS

two little borrowed faves:

  • show
  • state
See the entry manual entry for details on the associated options. she's sharing with her cousin. ๐Ÿซถ

INHERITED OPTIONS

passed down from the ancestors, no cap:

  • disabledForeground
  • labelBitmap
  • labelFontlabelImage
  • labelMargin
  • labelPos
  • labelText
  • labelVariable
  • state
  • sticky
See the labeledwidget class manual entry for details on the inherited options. ๐Ÿ’œ

WIDGET-SPECIFIC OPTIONS

okay this is the main character section. buckle up. ๐Ÿฆ‹

  • Name: childSitePos Class: Position Command-Line Switch: -childsitepos

says where the child site sits inside the entry field: n, s, e, or w. the default is e. compass girlie behavior. ๐Ÿงญ

  • Name: command Class: Command Command-Line Switch: -command

a Tcl command to run the second a Return key press event is detected. press enter, things happen. โœจ

  • Name: fixed Class: Fixed Command-Line Switch: -fixed

locks the entry down to a set number of chars. a value of 0 โ€” which is the default โ€” means no limit at all, live your life. the value is the max number of chars the user may type into the field, regardles of field width. like for example: if the field width is 20 and the fixed value is 10, the user will only be able to type 10 characters into the field which is 20 characters long. the vibes are constrained but the box is big. ๐Ÿ˜ญ

  • Name: focusCommand Class: Command Command-Line Switch: -focuscommand

a Tcl command to run when she receives focus. she's paying attention now. ๐Ÿ‘€

  • Name: invalid Class: Command Command-Line Switch: -invalid

a Tcl command to run when invalid input gets detected. the default is bell. ๐Ÿ””

  • Name: textBackground Class: Background Command-Line Switch: -textbackground

background color for the inside textual portion of the entry field. the value may be given in any of the forms acceptable to Tk_GetColor. ๐ŸŽจ

  • Name: textFont Class: Font Command-Line Switch: -textfont

name of the font used to display text in the entryfield. the value may be given in any of the forms acceptable to Tk_GetFont. typography moment fr fr. ๐Ÿ”ค

  • Name: pasting Class: Behavior Command-Line Switch: -pasting

enable or disable pasting into the entry component of the entryfield. valid values are 0 (disabled) or 1 (enabled). defaults to 1. yes bestie you can paste, unless you choose chaos. ๐Ÿ™ˆ

  • Name: validate Class: Command Command-Line Switch: -validate

the validate option lets you set up a whole validation mechanism. standard character validation like numeric, alphabetic, integer, hexidecimal, real, and alphanumeric can all be handled through the use of keywords. and if you need something more extensive, the value may contain the name of a command script. the script should return a boolean value. True for valid, false for invalid. if false is returned, then the procedure associated with the invalid option will be invoked. ๐Ÿ’€

and here's the spicy part: if the validation script contains any % characters, then the script will not be executed directly. instead, a new script will be generated by replacing each %, and the character following it, with information from the entryfield. the replacement depends on the character following the %, as defined in the list below. ๐Ÿ‘‡

  • %c โ€” replaced with the current input character.
  • %P โ€” replaced with the contents of the entryfield modified to include the latest keystoke. this is equivalent to peeking at the future contents, enabling rejection prior to the update. she's a time traveler lowkey. ๐Ÿ”ฎ
  • %S โ€” replaced with the current contents of the entryfield prior to the latest keystroke being added.
  • %W โ€” replaced with the entryfield widget pathname.

DESCRIPTION

the iwidgets::entryfield command creates an enhanced text entry widget with an optional associated label. addtional options support validation and establishing a upper limit on the number of characters which may be entered in the field. she's an entry field but make it extra. ๐ŸŒธ


METHODS

the iwidgets::entryfield 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 entryfield widgets: ๐Ÿ’ซ

ASSOCIATED METHODS

the borrowed besties:

  • delete
  • get
  • icursor
  • index
  • insert
  • scan
  • selection
  • xview
See the entry manual entry for details on the associated methods. ๐Ÿซถ

WIDGET-SPECIFIC METHODS

the ones she brought herself:

  • pathName cget option โ€” returns the current value of the configuration option given by option. option may have any of the values accepted by the iwidgets::entryfield command.
  • pathName childsite โ€” returns the path name of the child site. ๐Ÿ“
  • pathName clear โ€” clear entry widget. poof. gone. ๐Ÿงน
  • 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 no 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. option may have any of the values accepted by the iwidgets::entryfield command. the whole shebang. ๐Ÿ’…

COMPONENTS

  • Name: efchildsite Class: frame

the efchildsite component is the user child site for the entry field. See the frame widget manual entry for details on the efchildsite component item. ๐Ÿ–ผ๏ธ

  • Name: entry Class: entry

the entry component provides the entry field for user text input and display. See the entry widget manual entry for details on the entry component item. โœ๏ธ


EXAMPLE

here's the whole fit, styled and ready:

package require Iwidgets 4.0
option add *textBackground white

proc returnCmd {} {
    puts stdout "Return Pressed"
}

proc invalidCmd {} {
    puts stdout "Alphabetic contents invalid"
}

iwidgets::entryfield .ef -command returnCmd

iwidgets::entryfield .fef -labeltext "Fixed:" -fixed 10 -width 12

iwidgets::entryfield .nef -labeltext "Numeric:" -validate numeric
-width 12

iwidgets::entryfield .aef -labeltext "Alphabetic:" \
   -validate alphabetic -width 12 -invalid invalidCmd

iwidgets::entryfield .pef -labeltext "Password:" \
   -show 267 -width 12 -command returnCmd

iwidgets::Labeledwidget::alignlabels .ef .fef .nef .aef .pef

pack .ef -fill x -expand yes -padx 10 -pady 5
pack .fef -fill x -expand yes -padx 10 -pady 5
pack .nef -fill x -expand yes -padx 10 -pady 5
pack .aef -fill x -expand yes -padx 10 -pady 5
pack .pef -fill x -expand yes -padx 10 -pady 5

align those labels, pack those frames, and serve. ๐Ÿ“


AUTHOR

Sue Yockey Mark L. Ulferts

(legends. both of them. ๐Ÿ™Œ)


KEYWORDS

entryfield, widget


and that's the whole page bestie!! this manual comes to you from Tk, page iwidgets::entryfield(1) โ€” go forth and make entry fields that eat. โœจ๐Ÿ’– no cap. ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from