Click or drag to resize

ComboBox Class (Typed)

X#
Create a combo box, which is used when you need to provide the user with both a list of choices and an edit control (to optionally allow them to type in their own choice).
Inheritance Hierarchy
Object
  VObject
    Control
      TextControl
        BaseListBox
          ListBox
            ComboBox
              ComboBoxEx

Namespace:  XSharp.VO.SDK
Assembly:  XSharp.VOGUIClasses (in XSharp.VOGUIClasses.dll) Version: 2.19
Syntax
[TypesChangedAttribute]
 CLASS ComboBox INHERIT ListBox
Request Example View Source

The ComboBox type exposes the following members.

Constructors
  NameDescription
Public methodComboBox
Construct a combo box.
Top
Properties
  NameDescription
Public propertyBackground
The brush used for painting the background of the control. For example, in a single line edit control, the background is the color behind the text in the edit control.
(Inherited from Control.)
Public propertyCaption
The string representing the caption of the list box.
(Inherited from ListBox.)
Public propertyContextMenu
A menu object representing the local pop-up menu for a control.
(Inherited from Control.)
Public propertyControlFont
The font used to draw the text in the control.
(Inherited from TextControl.)
Public propertyControlID
A number between 1 and 8000 representing the unique ID of a control
(Inherited from Control.)
Public propertyControlType (Overrides ControlType.)
Public propertyCurrentItem
A string representing the displayed list box or combo box item selected.
(Inherited from ListBox.)
Public propertyCurrentItemNo
A numeric value, between 1 and the ListBox:ItemCount, indicating which item is currently selected.
(Inherited from ListBox.)
Public propertyCurrentText
ComboBox:CurrentText contains the text currently appearing in the edit box area of the combo box. The CurrentText assign also changes TextValue and Value. If the assigned CurrentText does not match one of the displayed items, then CurrentItemNo is set to 0. If the assigned value represents a change, then ValueChanged will be set to TRUE.
(Overrides CurrentText.)
Public propertyEditHandle
The handle to the edit portion of a ComboBox control.
Public propertyEditHeight
Integer value specifying the height of the embedded edit control.
Public propertyEventReturnValue (Inherited from Control.)
Public propertyFieldSpec (Inherited from Control.)
Public propertyHasFocus (Inherited from Control.)
Public propertyHyperLabel
The hyperlabel connected to the control.
(Inherited from Control.)
Public propertyIsBusy (Inherited from BaseListBox.)
Public propertyIsComboBox
Is the control a ComboBox
(Inherited from BaseListBox.)
Public propertyIsHidden (Inherited from Control.)
Public propertyIsListBox
Is the control a ListBox
(Inherited from BaseListBox.)
Public propertyLength
A numeric value representing the number of characters in the control.
(Inherited from TextControl.)
Public propertyModified
A logical value that is set to TRUE when a standard edit control or editable combo box is in the process of being modified.
(Inherited from Control.)
Public propertyMultiSelection (Overrides MultiSelection.)
Public propertyName
A string representing the name of the control.
(Inherited from Control.)
Public propertyNameSym
A symbol representing the name of the control.
(Inherited from Control.)
Public propertyOrigin
A point representing the location of a control on its owner window, in canvas coordinates.
(Inherited from Control.)
Public propertyOwner
The owner window of a control.
(Inherited from Control.)
Public propertyOwnerAlignment
Constant representing how the window will be aligned within its owner window.
(Inherited from Control.)
Public propertyParent (Inherited from Control.)
Public propertySelectedCount
A numeric value representing the total number of items that are currently selected in a multiple selection list box.
Tip Tip
This property is intended for use with a multiple selection list box (i.e., a list box created using the LBOXMULTIPLESEL style).
(Inherited from ListBox.)
Public propertySelectedFile (Inherited from ListBox.)
Public propertyServer
The server object that currently connected to this control. If no server is connected, the value is NIL.
(Inherited from Control.)
Public propertySize
A dimension representing the size of a control.
(Overrides Size.)
Public propertyStatus
A hyperlabel indicating the status of the control after a validation attempt or other action.
(Inherited from Control.)
Public propertySWFControl (Inherited from Control.)
Public propertyTextColor
The color used to draw the text in the control. (Refer to the Color:Init() method for details on specifying a color object.)
(Inherited from TextControl.)
Public propertyTextValue
A string representing the display value (first array's element) for the currently selected item.
(Inherited from ListBox.)
Public propertyToolTipText
String value representing the tooltip text used when the user moves the mouse pointer over the control.
(Inherited from Control.)
Public propertyUseHLForToolTip
Logical value determining whether the descriptive text of a control's Hyperlabel should be used as the tooltip text.
(Inherited from Control.)
Public propertyCode exampleValue
The value held in the control, in whatever data type the control holds.
(Inherited from Control.)
Public propertyValueChanged (Inherited from Control.)
Top
Functions
  NameDescription
Public methodActivate
Provide a method that is invoked when the control has focus and a window is activated.

(Inherited from Control.)
Public methodAddChild (Inherited from Control.)
Public methodAddItem
Add a new item to a list box at a specified position.
(Inherited from ListBox.)
Public methodAsString (Inherited from Control.)
Public methodBringToFront (Inherited from Control.)
Public methodChangeSelected
Change a range of items in a multiple selection list box to a specified selection.
(Inherited from ListBox.)
Public methodClear (Inherited from ListBox.)
Public methodClearSelection
Clear a multiple selection list box of all selections.
(Inherited from ListBox.)
Public methodCreate (Overrides Create.)
Public methodCreateWindowEx (Inherited from Control.)
Public methodDeactivate
Provide a method that is invoked when the control has focus and a window is deactivated.

(Inherited from Control.)
Public methodDefault
Call the default windows procedure for a control and set the EventReturnValue.
(Inherited from Control.)
Public methodDeleteItem
Remove an item from a list box.
(Inherited from ListBox.)
Public methodDeselectItem
Turn off the selection of a specified item in a list box.
(Inherited from ListBox.)
Public methodDestroy
Provide a method to de-instantiate any TextControl.Destroy object.
(Inherited from TextControl.)
Public methodDisable
Disable a control (until a subsequent call to Control:Enable()).
(Inherited from Control.)
Public methodDisableTheme
Disable the WinXP theme for a control.
(Inherited from Control.)
Public methodDispatch
Provide the prototype dispatcher for events within the system when the control has focus; routing various events to their appropriate event handlers.

(Inherited from Control.)
Public methodDrop (Inherited from Control.)
Public methodEnable
Enable a control that was previously disabled.
(Inherited from Control.)
Public methodEnableItemDrag
Turn the list box into a drag list box.
(Inherited from ListBox.)
Public methodExpose
Provide a method that is invoked when the control has focus and whenever part of the window needs repainting.

(Inherited from Control.)
Public methodFillUsing (Overrides FillUsing(Usual, Usual, Usual).)
Public methodCode exampleFillUsingBySortedList
Specify the set of values to be displayed in the list box, using an array or a data server. These values act as a constraint on the values that may be entered in the list box, and optionally as a translation between program values and display values.
(Inherited from ListBox.)
Public methodFindItem
Search a list box for a specified string, and return the location of the first item in the list box that matches it.
(Inherited from BaseListBox.)
Public methodFirstSelected
Returns the position of the first item selected in a multiple selection list box, or 0 if no item is selected.
(Inherited from ListBox.)
Public methodFocusChange
Provide a method that is invoked when the control has focus and the input focus changes from the current control to another (or vice versa).

(Inherited from Control.)
Public methodGetItem
Retrieve the text of a specified list box item.
(Inherited from BaseListBox.)
Public methodGetItemDisplayValue (Inherited from BaseListBox.)
Public methodGetItemValue (Inherited from BaseListBox.)
Public methodGetOptimalWidth (Inherited from ListBox.)
Public methodHandle
Return the handle for a control.
(Inherited from Control.)
Public methodHasBorder
Check if a border has been set for the control
(Inherited from Control.)
Public methodHasStyle
Check if a style value has been set for the control
(Inherited from Control.)
Public methodHide
Hide a control so it is not visible (until a subsequent call to Control:Show()).
(Inherited from Control.)
Public methodHorizontalScroll
Provide a method that is invoked when the control has focus and a horizontal scroll bar is scrolled.

(Inherited from Control.)
Public methodIme
Return and optionally set whether Input Method Editor is enabled for this text control.
(Inherited from TextControl.)
Public methodIsEnabled
Report if this control is currently enabled.
(Inherited from Control.)
Public methodIsReadOnly
Report if this control is currently readonly.
(Inherited from Control.)
Public methodIsSelected
Determine if the list box item at the specified index position is selected.
(Inherited from ListBox.)
Public methodIsVisible
Report if this control is visible (completely or partially) or hidden.
(Inherited from Control.)
Public methodKeyDown
Provide a method that is invoked when the control has focus and a key on the keyboard is pressed.

(Inherited from Control.)
Public methodKeyUp
Provide a method that is invoked when the control has focus and a key on the keyboard is released.

(Inherited from Control.)
Public methodLinkDF
Connect a control to a data field in a data server.
(Inherited from Control.)
Public methodListFiles Obsolete.
Fill a list box with the names of all files that match the specified path or file name.
(Inherited from ListBox.)
Public methodMenuInit
Provide a method that is invoked when a pop-up menu owned by the control is about to pop up.
(Inherited from Control.)
Public methodMenuSelect
Provide a method that is invoked when an item on a menu owned by the control is highlighted.
(Inherited from Control.)
Public methodMouseButtonDoubleClick
Provide a method that is invoked when the control has focus, the mouse pointer is positioned over the window, and a mouse button is double-clicked.

(Inherited from Control.)
Public methodMouseButtonDown
Provide a method that is invoked when the control has focus, the mouse pointer is positioned over the window, and a mouse button is clicked.

(Inherited from Control.)
Public methodMouseButtonUp
Provide a method that is invoked when the control has focus, the mouse pointer is positioned over the window, and a mouse button is released.
(Inherited from Control.)
Public methodMouseDrag
Provide a method that is invoked when the control has focus and a mouse with one or more buttons clicked is moved in the window.
(Inherited from Control.)
Public methodMouseMove
Provide a method that is invoked when the control has focus and the mouse is moved in the control.
(Inherited from Control.)
Public methodMove
Provide a method that is invoked when the control has focus and the control is moved (either by the user or by the application).
(Inherited from Control.)
Public methodNextSelected
After calling ListBox:FirstSelected(), this method is used to cycle through the remaining items selected in a multiple selection list box.
(Inherited from ListBox.)
Public methodOnControlCreated (Overrides OnControlCreated(IVOControl).)
Public methodOnHandleDestroyed (Inherited from TextControl.)
Public methodOverRide
This is a compatibility method that is no longer used or needed.
(Inherited from Control.)
Public methodPaintBackGround (Inherited from Control.)
Public methodPerformValidations
Perform all the validations defined to this control's field specification (for example, required, maximum and minimum digits, maximum and minimum value, validation rule) and return the result of the test.
(Inherited from Control.)
Public methodRegisterTimer
Register a timer method to be invoked for the control.
(Inherited from Control.)
Public methodRemoveEditBalloonTip
Removes the current BallonTip from the Edit control that has inherited from this class.
(Inherited from TextControl.)
Public methodRePaint
Send an ExposeEvent to repaint the control
(Inherited from Control.)
Public methodResize
Provide a method that is invoked when the control has focus and the control changes size.
(Inherited from Control.)
Public methodRestoreUpdate
Resume all drawing updates for a control (after Control:SuspendUpdate() is called).
(Inherited from Control.)
Public methodSelectItem
Turn on the selection of an item in a list box.
(Inherited from ListBox.)
Public methodSendToBack (Inherited from Control.)
Public methodSetCueBanner(String)
Add a cue banner to the Edit portion of the ComboBox control.
(Overrides SetCueBanner(String).)
Public methodSetCueBanner(String, IntPtr) (Inherited from TextControl.)
Public methodSetExStyle
Set the exstyle for the control.
(Inherited from Control.)
Public methodSetFocus
Pass input focus to a control, thereby directing all mouse and keyboard input to the control.
(Inherited from Control.)
Public methodSetItemValue (Inherited from BaseListBox.)
Public methodSetStyle
Set the style for the control.
(Inherited from Control.)
Public methodSetTabs (Inherited from ListBox.)
Public methodSetTop
Move a specified item to the top of the list box.
(Inherited from BaseListBox.)
Public methodShow
Display a control so it is visible.
(Inherited from Control.)
Public methodShowEditBalloonTip
Add a BallonTip to the Edit control that has inherited from this class.
(Inherited from TextControl.)
Public methodShowToolTip (Inherited from Control.)
Public methodSuspendUpdate
Temporarily suspend all drawing updates for a control; drawing resumes with a call to Control:RestoreUpdate().
(Inherited from Control.)
Public methodTimer
Provide a method to be invoked at specific intervals defined when the timer is registered though the RegisterTimer() method.
(Inherited from Control.)
Public methodValidateControl
This method validates if the control has been created and when not then it triggers the control creation
(Inherited from Control.)
Public methodVerticalScroll
Provide a method that is invoked when the control has focus and a vertical scroll bar is scrolled.
(Inherited from Control.)
Top
Globals and Defines
  NameDescription
Public fieldoCargo
Cargo slot.
(Inherited from VObject.)
Top
Remarks
A combo box (also known as a combination box) is a control that combines the abilities of an edit control and a list box. There are three types of combo boxes—simple, drop-down, and drop-down list. A combo box displays a list of items or choices to the user, as well as allowing text to be entered directly into an edit area. The combo box methods will allow you to add, arrange, remove, and interrogate the list of items. When one of the items is selected, ComboBox:CurrentItem, ComboBox:CurrentItemNo, ComboBox:TextValue, and ComboBox:Value are updated. Either a one-dimensional or two-dimensional array is specified in the FillUsing() method, with a row for each of the items available for selection. With a two-dimensional array, the first element is called the display value, and the second element is called the return value. When an item is selected, the ComboBox:TextValue contains the first element (the display value), and ComboBox:Value contains the second element (the return value). When text is directly entered, ComboBox:CurrentItemNo is set to 0 and the new text is stored in ComboBox:TextValue and ComboBox:Value. A combo box may be bound to a field (character, date, logical, numeric, or memo) in a server. The field's data value is stored in ComboBox:Value. The combo box compares the data value to the second element values specified in the FillUsing() array, and if a match is found, the first element (the display value) is stored in ComboBox:TextValue. In a "no-match" situation, the combo box shows no item selected, ComboBox:CurrentItem is NULL_STRING, ComboBox:CurrentItemNo is set to 0, and ComboBox:TextValue and ComboBox:Value reflect the field contents. If an item is selected, ComboBox:CurrentItemNo is set to a number between 1 and ComboBox:ItemCount, and the corresponding second element is stored as ComboBox:Value and as the field's data value. If text is directly entered, it will also be stored as the field's data value. Use the Window:ListBoxSelect() event handler to respond to selections, and the Window:ListBoxClick() event handler to respond to choices. A combo box is primarily a selection device, so there is no special support for the functionality available in the Edit class. However, the contents of the edit component can be changed or obtained using the inherited CurrentText access/assign methods. The combo box also generates EditFocusChangeEvents when its edit control loses or receives the focus.
Examples
This example creates a combo box and fills it with a list of animals:
X#
 1CLASS MyWindow INHERIT TopAppWindow
 2HIDDEN oCB AS OBJECT
 3METHOD Init() CLASS MyWindow
 4SUPER:Init()
 5oCB := ComboBox{SELF,42,Point{10,10},;
 6Dimension{100,40},BOXDROPDOWN}
 7oCB:AddItem("Pig")
 8oCB:AddItem("Cow")
 9oCB:AddItem("Horse")
10oCB:Show()
This example creates a combo box with different currencies, showing an explicit representation to the user but using a different representation internally:
X#
 1METHOD Init(...) CLASS OrderWindow
 2...
 3oCBCurrency := ComboBox{SELF,CBCURRENCY_ID}
 4oCBCurrency:FillUsing({;
 5{"U.S. Dollars","USD"},;
 6{"Can. Dollars","CDN"},;
 7{"Mexican Pesos","MEX"},;
 8{"Yen","YEN"},;
 9{"British Pounds","UK"},;
10{"German Marks","DM"};
11})
12oCBCurrency:Show()
This example creates a combo box that shows the products available in the product table:
X#
1METHOD Init(...) CLASS OrderWindow
2...
3oCBProducts := ComboBox{SELF,CBPRODUCTS_ID}
4oCBProducts:FillUsing(oDBProducts,#ProdName,#ProdNo)
5oCBProducts:Show()
See Also