PC SOFT

WINDEV的在线文档

  • Overview
  • Initializing and filling a Combo Box control
  • Initializing an element
  • Initializing the edit control (editable combo box)
  • Filling a Combo Box control
  • Selecting an element in a Combo Box control
  • Selecting an element in a Combo Box control
  • Selecting the last element of a Combo Box control
  • Retrieving the element selected in the Combo Box control
  • Retrieving the subscript of the selected element
  • Retrieving the value of the selected element
  • Finding an element in a Combo Box control with table
  • Properties specific to the management of Combo Box controls
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

Handling a Combo Box control by programming

Overview
WinDev, WinDev Mobile and WebDev allow you to handle a Combo Box control by programming. To do so, use the variable of the Combo Box control in the code. This variable is a numeric variable.

The variable of the Combo Box control:

  • corresponds to the name of the Combo Box control.
  • is initialized with the subscript of the element selected in the control.
To handle an element of the Combo Box control, use the following notation:

<Name of Combo Box>[<Element Subscript>]

Note: Several WLanguage functions are specific to the management of the Combo Box controls. For more details, see: the functions for managing the list boxes and the combo boxes and functions specific to the management of Combo Box controls.

Initializing and filling a Combo Box control

Initializing an element

To initialize an element in a Combo Box control (editable or not), use 列表添加.

To modify an element found in a Combo Box control (editable or not), use direct assignment:

<Name of Combo Box>[Subscript] = <Value>

WinDev

Initializing the edit control (editable combo box)

To initialize the control of an editable combo box, use:

  • the direct assignment:
<Combo Box Name> = <Value>

// Add elements into a list
列表添加COMBO_COMBO1"MOORE"
列表添加COMBO_COMBO1Cust_Name

Filling a Combo Box control

To initialize a Combo Box control, all you have to do is use an iteration loop to initialize all the elements of the control.

Subscript is int
FOR Subscript = <Start Position> TO <End Position>
列表添加(<Name of Combo Box>, <Value>)
END

Example:

i整数型
对于i1直到52
列表添加COMBO_COMBONAMEi】)
结束

Selecting an element in a Combo Box control

Selecting an element in a Combo Box control

To select the element found at <Subscript> row, use:
  • the direct assignment:
<Name of Combo Box> = Subscript
列表选择元素(<Name of Combo Box>, <Subscript>)

WinDev Note: For an editable combo box, only the second syntax is allowed.

Selecting the last element of a Combo Box control

To point to the last element of the Combo Box control, use:
<Name of Combo Box> = <Name of Combo Box>..数目

列表选择元素(<Name of Combo Box>, <Name of Combo Box>..数目)

<Name of Combo Box> = 列表元素数目(<Name of Combo Box>)

WinDev Note: For an editable combo box, only the last syntax is allowed.

Retrieving the element selected in the Combo Box control

Retrieving the subscript of the selected element

To retrieve the subscript of the selected element, use:
  • a read operation performed on the element:
Subscript = <Name of Combo Box>

Subscript = 列表选定元素(<Name of Combo Box>)

WinDev Note: These two syntaxes can be used in the editable or non-editable Combo Box controls. In an editable Combo Box control, if the element was modified in the edit control, 列表选定元素 returns the content of the edit control.

Retrieving the value of the selected element

To retrieve the value of the selected element, use one of the following syntaxes:
  • Syntax 1 (non-editable combo box)
subscript is int = <Name of Combo Box>
<Variable> = <Name of Combo Box>[Subscript]

  • Syntax 2 (non-editable combo box)
<Variable> = <Name of Combo Box>[<Name of Combo Box>]

  • Syntax 3: ..显示值 (editable or non-editable combo box)
<Variable> = <Name of Combo Box>..显示值

  • WinDev Special syntax (editable combo box)
<Variable> = <Name of Combo Box>

Finding an element in a Combo Box control with table
WinDev To find an element in a Combo Box control with table, use 表格查找数据.

Reminder: To perform a search in a "standard" Combo Box control, use 列表查找数据.

Properties specific to the management of Combo Box controls
The following properties are used to manage the Combo Box controls:
Any type of combo box
水平对齐Used to find out and modify the horizontal alignment of the elements found in the Combo Box control.
17版本和更高版本
省略号
17新版本
省略号
省略号
Used to find out and modify the management mode of the ellipsis.
行高Used to find out and modify the height of the rows in a Combo Box control.
内存Used to find out whether the specified control is a memory or browsing Combo Box control.
数目Used to find out the number of rows in a Combo Box control.
填充类型Used to find out how a Combo Box control is filled (file, memory, variable).
Used to find out whether a Combo Box control is empty.
Editable combo box only
17版本和更高版本
允许输入
17新版本
允许输入
允许输入
Used to find out and modify the input mode of the Combo Box control (editable or not).
光标Used to find out and modify the position of the mouse cursor in a control.
光标结束Used to find out and modify the position of end of selection of the mouse cursor.
17版本和更高版本
存储格式
17新版本
存储格式
存储格式
Used to find out and modify the format of the returned value.
17版本和更高版本
显示掩码
17新版本
显示掩码
显示掩码
Used to find out and modify the display mask.
输入掩码Used to find out and modify the input mask.
大小Used to find out and modify the maximum number of characters contained in the edit control of the combo box.
选定文本Used to find out and modify the text selected in the edit control of the combo box.
17版本和更高版本
输入类型
17新版本
输入类型
输入类型
Used to find out and modify the type of data entered in the edit control of the combo box.
Memory combo box only
初始内容Used to find out the initial content of a memory Combo Box control.
已排序Used to find out whether a memory Combo Box control is sorted and to sort a memory Combo Box control.
Browsing combo box only
文件浏览Used to find out and modify the file or query used to display the records in the browsing Combo Box controls.
自动浏览Used to find out whether a browse performed in a browsing Combo Box control is managed automatically or by programming.
字段显示Used to find out and modify the item displayed in a Combo Box control.
字段记忆Used to find out or modify the stored item of a Combo Box control.
字段浏览Allows you to find out and modify the item used to automatically browse the Combo Box controls.

To find out the entire list of WLanguage properties that can be used with a Combo Box control, see Properties associated with the Combo Box control.