⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 combobox.n

📁 linux 下的源代码分析阅读器 red hat公司新版
💻 N
字号:
'\"'\" Copyright (c) 1995 John S. Sigler'\" Copyright (c) 1997 Mitch Gorman'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\"'\" @(#) Combobox.n'/" .so man.macros.HS combobox iwid.BS'\" Note:  do not modify the .SH NAME line immediately below!.SH NAMEcombobox \- Create and manipulate combination box widgets.SH SYNOPSIS\fBcombobox\fI \fIpathName \fR?\fIoptions\fR?.SH "INHERITANCE"itk::Widget <- LabeledWidget <- Entryfield <- Combobox.SH "STANDARD OPTIONS".LP.ta 4c 8c 12c.nf\fB\fR\fBbackground	borderWidth	cursor	justifyexportSelection	foreground	highlightColor	highlightThicknessrelief	width	insertWidth	insertBackgroundinsertOffTime	insertOnTime	insertWidth	insertBorderWidthselectForeground	selectBackgroundselectBorderWidth	textVariable\fR.fi.LPSee the "options" manual entry for details on the standard options..SH "ASSOCIATED OPTIONS".LP.nf.ta 4c 8c 12c\fBhscrollmode\fR	\fBtextBackground\fR	\fBtextFont\fR	\fBvscrollmode\fR.fi.LPSee the "scrolledlistbox" manual entry for details on the above inherited options..LP.nf.ta 4c 8c 12c\fBshow\fR.fi.LPSee the "entry" manual entry for details on the above inherited option..SH "INHERITED OPTIONS".LP.nf.ta 4c 8c 12c\fBchildSitePos\fR	\fBcommand\fR	\fBfixed\fR	\fBfocusCommand\fR\fBinvalid\fR	\fBtextBackground\fR	\fBtextFont\fR	\fBvalidate\fR.fi.LPSee the "entryfield" class manual entry for details on the inherited options..LP.nf.ta 4c 8c 12c\fBlabelBitmap\fR	\fBlabelFont\fR	\fBlabelImage\fR	\fBlabelMargin\fR\fBlabelPos\fR	\fBlabelText\fR	\fBlabelVariable\fR.fi.LPSee the "labeledwidget" class manual entry for details on the inherited options..SH "WIDGET-SPECIFIC OPTIONS".LP.nfName:	\fBarrowRelief\fRClass:	\fBRelief\fRCommand-Line Switch:	\fB-arrowrelief\fR.fi.IPSpecifies the relief style to use for a dropdown Combobox's arrowbutton in a normal (not depressed) state. Acceptable values are \fBraised\fR, \fBsunken\fR, \fBflat\fR, \fBridge\fR, and \fBgroove\fR.  Sunken is discouraged as this is the relief used to indicate a depressed state. This option has no effect on simple Comboboxes. The default is raised..LP.nfName:	\fBcompletion\fRClass:	\fBCompletion\fRCommand-Line Switch:	\fB-completion\fR.fi.IPBoolean given in any of the forms acceptable to \fBTcl_GetBoolean\fR whichdetermines whether insertions into the entry field, whether from thekeyboard or programmatically via the \fBinsert\fR method, areautomatically completed with the first matching item from the listbox.  Thedefault is true..LP.nfName:	\fBdropdown\fRClass:	\fBDropdown\fRCommand-Line Switch:	\fB-dropdown\fR.fi.IPBoolean describing the Combobox layout style given in any of the formsacceptable to \fBTcl_GetBoolean\fR. If true, the Combobox will be a dropdown stylewidget which displays an entry field and an arrow button which when activatedwill pop up a scrollable list of items. If false, a simple Combobox style will be used which has an entry field and a scrollable list beneath it which is always visible. Both styles allow an optional label for the entryfield area. The default is true. .LP.nfName:	\fBeditable\fRClass:	\fBEditable\fRCommand-Line Switch:	\fB-editable\fR.fi.IPBoolean describing whether or not the text entry area is editableby the user. If true the user can add items to the combobox by entering textinto the entry area and then pressing Return. If false, the list of items isnon-editable and can only be changed by calling the insert or deletemethods. (The value in the entry field can still be modified by selectingfrom the list.)  Given in any of the forms acceptable to \fBTcl_GetBoolean\fR. The default is true..LP.nfName:	\fBgrab\fRClass:	\fBGrab\fRCommand-Line Switch:	\fB-grab\fR.fi.IPThis option sets the grab scope for the appearance of the listbox indrop-down comboboxes.  It can be either global or local.  The default islocal..LP.nfName:	\fBlistHeight\fRClass:	\fBHeight\fRCommand-Line Switch:	\fB-listheight\fR.fi.IPHeight of the listbox specified in any of the forms acceptable to \fBTk_GetPixels\fR.  The default is 150 pixels..LP.nfName:	\fBmargin\fRClass:	\fBMargin\fRCommand-Line Switch:	\fB-margin\fR.fi.IPSpecifies the width in pixels between the entry component and the arrow buttonfor a dropdown Combobox given in any of the forms acceptable to \fBTk_GetPixels\fR. This option has no effect on a simple Combobox. Thedefault is 1..LP.nfName:	\fBpopupCursor\fRClass:	\fBCursor\fRCommand-Line Switch:	\fB-popupcursor\fR.fi.IPSpecifies the cursor to be used for dropdown style listboxes. The valuemay have any of the forms acceptable to \fBTk_GetCursor\fR. The default isarrow. .LP.nfName:	\fBselectionCommand\fRClass:	\fBSelectionCommand\fRCommand-Line Switch:	\fB-selectioncommand\fR.fi.IPSpecifies a Tcl command procedure which is called when an item in thelistbox area is selected. The item will be selected in the list, the listbox will be removed if it is a dropdown Combobox, and the selected item's text will be inserted into the entry field before the -selectioncommand proc iscalled. The default is {}..LP.nfName:	\fBstate\fRClass:	\fBState\fRCommand-Line Switch:	\fB-state\fR.fi.IPSpecifies the overall state of the Combobox megawidget.  Can be eithernormal or disabled.  If the Combobox is disabled, no text can be enteredinto the entry field, no selection can be made in the listbox, and thearrowBtn component is disabled.  The default is normal..LP.nfName:	\fBunique\fRClass:	\fBUnique\fRCommand-Line Switch:	\fB-unique\fR.fi.IPBoolean describing whether or not duplicate items are allowed in the comboboxlist. If true, then duplicates are not allowed to be inserted. If false, aduplicate entry causes selection of the item. Given in any of the formsacceptable to \fBTcl_GetBoolean\fR. The default is true. .BE.SH DESCRIPTION.PPThe \fBcombobox\fR command creates an enhanced entry field widget with anoptional associated label and a scrollable list. When an item is selected inthe list area of a Combobox, its value is then displayed in the entry fieldtext area. Functionally similar to an Optionmenu, the Combobox adds (optional)list scrolling and (optional) item editing and inserting capabilities. .PPThere are two basic styles of Comboboxes (determined by the -dropdown option):dropdown and simple. The dropdown style adds an arrow button to the right ofthe entry field which when activated will pop up (and down) the scrolledlistbox beneath the entry field. The simple (non-dropdown) Combobox permanently displays the listbox beneath the entry field and has no arrow button. Either style allows an optional entry field label..SH "METHODS".PPThe \fBcombobox\fR command creates a new Tcl command whosename is \fIpathName\fR. Thiscommand may be used to invoke variousoperations on the widget. It has the following general form:.DS C\fIpathName option \fR?\fIarg arg ...\fR?.DE\fIOption\fR and the \fIarg\fRsdetermine the exact behavior of the command. The followingcommands are possible for Combobox widgets:.SH "ASSOCIATED METHODS".LP.nf.ta 4c 8c 12c\fBicursor\fR	\fBscan\fR.fi.LPSee the "entry" manual entries for details on the above associated methods..LP.nf.ta 4c 8c 12c\fBcurselection\fR	\fBindex\fR	\fBsee\fR	\fBsize\fR\fBxview\fR	\fByview\fR.fi.LPSee the "listbox" manual entries for details on the above associated methods..LP.nf.ta 4c 8c 12c\fBgetcurselection\fR	\fBjustify\fR	\fBsort\fR.fi.LPSee the "scrolledlistbox" manual entries for details on the above associated methods..LP.SH "WIDGET-SPECIFIC METHODS".TP\fIpathName \fBcget\fR \fIoption\fRReturns the current value of the configuration option givenby \fIoption\fR.\fIOption\fR may have any of the values accepted by the \fBcombobox\fRcommand..TP\fIpathName \fBclear\fR ?\fBcomponent\fR?Clears the contents from one or both components. Valid component valuesare \fBlist\fR, or \fBentry\fR.  With no component specified, both are cleared..TP\fIpathName\fR \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?Query or modify the configuration options of the widget.If no \fIoption\fR is specified, returns a list describing all ofthe available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR forinformation on the format of this list).  If \fIoption\fR is specifiedwith no \fIvalue\fR, then the command returns a list describing theone named option (this list will be identical to the correspondingsublist of the value returned if no \fIoption\fR is specified).  Ifone or more \fIoption\-value\fR pairs are specified, then the commandmodifies the given widget option(s) to have the given value(s);  inthis case the command returns an empty string.\fIOption\fR may have any of the values accepted by the \fBcombobox\fRcommand..TP\fIpathName \fBdelete \fIcomponent\fR \fIfirst\fR ?\fIlast\fR?Delete one or more elements from a given component, \fBlist\fR or \fBentry\fR.If a list item to be removed is currently selected (displayed in the entry field area), the entry field will be cleared..TP\fIpathName \fBget ?\fIindex\fR? \fRWith no arguments, returns the contents currently in the entry field area. With a single argument, returns the contents of the listbox item at the indicated index..TP\fIpathName \fBinsert\fR \fIcomponent\fR \fIindex\fR \fIelement\fR ?\fIelement element ...\fR?Insert one or more new elements into the given component, \fBlist\fR or\fBentry\fR, just before the element given by \fIindex\fR..TP\fIpathName \fBselection\fR \fIoption\fR \fIfirst\fR ?\fIlast\fR?Adjust the selection within the listbox component and updates the contentsof the entry field component to the value of the selected item. See the"listbox" manual entry for more details on parameter options..SH "COMPONENTS".LP.nfName:	\fBentry\fRClass:	\fBEntry\fR.fi.IPText entry area where the current selection is displayed. If the Combobox is editable and its state is normal, the user can edit the contents of this item..LP.nfName:	\fBlist\fRClass:	\fBScrolledlistbox\fR.fi.IPScrollable list which stores all the items which the user can selectfrom. For dropdown Comboboxes, this component is hidden until the user pops itup by pressing on the arrow button to the right of the entry component. Forsimple Comboboxes this component is always visible just beneath the entrycomponent..SH "DEFAULT BINDINGS".PPThe Combobox generally has the same bindings as its primary component items -the Scrolledlistbox and Entryfield. However it also adds these:.PP[1] Button-1 mouse press on the arrow key of a dropdown Combobox causes thelist to be popped up. If the combobox is non-editable, a Button-1 press on theentry field area will also pop up the list..PP[2] Button-1 mouse press anywhere on the display removes a dropdown listboxwhich has been popped up, unless the keypress is upon one of the Comboboxscrollbars which scrolls the list. If it is pressed upon an item in the listarea, that item will be selected before the list is removed..PP[3] Button-3 mouse press on the arrow key of a dropdown Combobox causes thenext item to be selected. Shift-Button-3 causes the previous item to beselected. .PP[4] Escape keypress removes a dropdown list which has been popped up. .PP[5] The <space> and <Return> keystrokes select the current item. They alsoremove the popped up list for dropdown comboboxes..PP[6] Up and Down arrow keypresses from the entry field and arrow buttoncomponent cause the previous and next items in the listbox to be selected respectively. Ctl-P and Ctl-N are similarly mapped for emacs emulation..PP[7] Entry field and arrow button component Shift-Up and Shift-Down arrow keyspop up and down the listbox of a dropdown Combobox. The arrow button componentalso maps <Return> and <space> similarly..SH EXAMPLE.DS proc selectCmd {} {    puts stdout "[.cb2 getcurselection]" } # # Non-editable Dropdown Combobox # combobox .cb1 -labeltext Month: \\     -selectioncommand {puts "selected: [.cb1 getcurselection]"} \\     -editable false -listheight 185 -popupcursor hand1  .cb1 insert list end Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec	 # # Editable Dropdown Combobox # combobox .cb2 -labeltext "Operating System:" -selectioncommand selectCmd .cb2 insert list end Linux HP-UX SunOS Solaris Irix .cb2 insert entry end L pack .cb1 -padx 10 -pady 10 -fill x  pack .cb2 -padx 10 -pady 10 -fill x.DE.SH ORIGINAL AUTHORJohn S. Sigler.SH CURRENT MAINTAINERMitch Gorman (logain@erols.com).SH KEYWORDScombobox, entryfield, scrolledlistbox, itk::Widget, entry, listbox, widget,iwidgets

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -