PC SOFT

WINDEV的在线文档

  • Overview of the Combo Box control
  • Control in a window, control in a dynamic or static page
  • Creating a Combo Box control
  • To create a Combo Box control:
  • Type of the expanded combo box
  • Characteristics of a Combo Box control
  • Editable combo box: type and mask of the input area
  • Adjusting the size of the expanded combo box
  • Drawing in the combo boxes
  • Vocabulary
  • Swapping
  • Example
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系: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本地访问

Overview of the Combo Box control

Control in a window, control in a dynamic or static page

The "Combo Box" control is used to display a list of elements and to select an element from this list.

Unlike a List Box control , a Combo Box control is not expanded: it is expanded upon request or when the cursor is positioned on the list.

16版本和更高版本
WinDevLinux The Combo Box controls are now available for the WinDev applications in Linux.
16新版本
WinDevLinux The Combo Box controls are now available for the WinDev applications in Linux.
WinDevLinux The Combo Box controls are now available for the WinDev applications in Linux.
18版本和更高版本
WinDevWindows Store apps The Combo Box controls are now available for the applications in Windows Store apps mode.
18新版本
WinDevWindows Store apps The Combo Box controls are now available for the applications in Windows Store apps mode.
WinDevWindows Store apps The Combo Box controls are now available for the applications in Windows Store apps mode.

WinDev In WinDev and WinDev Mobile, you can:
  • enter a value in the edit control if the Combo Box control is editable.
  • display the elements in table format if the Combo Box control contains several columns.
  • display the elements in listview format.
  • open a popup window.
  • resize the height and width of the expanded combo box (see below)

Some examples:

Combo sans saisie, non déroulée
Non-editable combo box, not expanded
Expanded combo box with elements in list format
Expanded combo box with elements in list format

WinDev The following examples apply to WinDev and to WinDev Mobile.

Combo déroulée avec éléments sous forme de table
Expanded combo box with elements in table format

Combo avec saisie et saisie assistée
Editable combo box with assisted input
Graphic combo box
Graphic combo box

Combo déroulée avec éléments sous forme de liste image
Expanded combo box with elements in listview format
Combo box that opens a popup window
Combo box that opens a popup window

The elements displayed in a combo box can be defined when creating the control in the editor. These elements:
  • are defined by programming.
  • come from a data file or from a query.

Creating a Combo Box control

To create a Combo Box control:

  1. In the window editor or in the page editor, click(or select "Insert .. Control .. Combo box").On the "创建" pane, in the "常用控件" group, click "组合框".
  2. Click the position where the control must be created in the page or in the window. The wizard for creating a Combo Box control is automatically started.
WinDev Tip: You also have the ability to create a "preset" combo box by clicking the arrow found to the right of the icon. The list of available controls (with their preview in the skin template of the project) is displayed. All you have to do is click the requested control to create it in the editor.
WinDev Tip: You also have the ability to create a "preset" combo box by expanding the "Combo box" option. The list of available controls (with their preview in the skin template of the project) is displayed. All you have to do is click the requested control to create it in the editor.

To display the characteristics of the control, select "Description" from the popup menu of the control.

18版本和更高版本
Windows Store apps For the applications in Windows Store Apps mode, we recommend that you use the native combo boxes ("Native combo box" in the "Details" tab of the description window of the control).
18新版本
Windows Store apps For the applications in Windows Store Apps mode, we recommend that you use the native combo boxes ("Native combo box" in the "Details" tab of the description window of the control).
Windows Store apps For the applications in Windows Store Apps mode, we recommend that you use the native combo boxes ("Native combo box" in the "Details" tab of the description window of the control).

WinDevWindows Store apps

Type of the expanded combo box

The type of the expanded combo box depends on the elements displayed by the Combo Box control . The available types are as follows:
  • list combo box: displays the elements in list format.
    For a browsing Combo Box control, the displayed item is defined in the "Content" tab of the description window of the control ("Description" from the popup menu).
  • table combo box: displays the elements in table format. A combo box with table is automatically created if the Combo Box control must display more than one element.
    To display the characteristics of columns, select "Description of columns" from the popup menu of the control (or click the "Edit the columns" button found in the "Content" tab of the description of the combo box).
    For a browsing Combo Box control, the displayed items are defined in the characteristics of the list columns ("Column Description" from the popup menu or "Edit the columns" button in the "Content" tab of the description window of the control).
  • listview combo box: displays the elements in listview format.
    To display the characteristics of the listview, click the "Edit the listview" button found in the "Content" tab of the description of the combo box.
    For a browsing Combo Box control, the item associated with the caption of the image and the item associated with the image are defined via the "Displayed item" and "Image item" options found in the "Content" tab of the combo box's ("Description" from the popup menu).
  • popup window combo box: opens a popup window.
    The popup window to open can be selected in the "Content" tab of the description window of the control ("Description" from the popup menu).
To change the type of the expanded combo box, select "Expanded type" found in the "Content" tab of the description of the combo box ("Description" from the popup menu).

Windows Store apps Only the expanded Combo Box controls of List type are available.

WinDevLinux In Linux for WinDev, only the expanded Combo Box controls whose type is List and Popup Window are available.

Characteristics of a Combo Box control
WinDev

Editable combo box: type and mask of the input area

For editable Combo Box controls, you can:
  • 17版本和更高版本
    WinDevWindows define the type of data entered in the edit control of the combo box: Text, Numeric, Currency, date, time, duration.
    17新版本
    WinDevWindows define the type of data entered in the edit control of the combo box: Text, Numeric, Currency, date, time, duration.
    WinDevWindows define the type of data entered in the edit control of the combo box: Text, Numeric, Currency, date, time, duration.
  • define an input mask. This mask depends on the type of information (date, text, ...) displayed in the combo box. Several input masks are available for each type.
    These input masks are multilingual: different input masks can be selected according to the runtime language of the project.
    These input masks can be modified by programming with ..输入掩码.
  • 17版本和更高版本
    WinDevWindows display an input mask. This display mask is available for editable combo boxes whose type is Numeric, Currency, date, time or duration.
    These display masks are multilingual: different input masks can be selected depending on the runtime language of the project.
    These input masks can be modified by programming with ..显示掩码.
    17新版本
    WinDevWindows display an input mask. This display mask is available for editable combo boxes whose type is Numeric, Currency, date, time or duration.
    These display masks are multilingual: different input masks can be selected depending on the runtime language of the project.
    These input masks can be modified by programming with ..显示掩码.
    WinDevWindows display an input mask. This display mask is available for editable combo boxes whose type is Numeric, Currency, date, time or duration.
    These display masks are multilingual: different input masks can be selected depending on the runtime language of the project.
    These input masks can be modified by programming with ..显示掩码.

To use multilingual masks:

  1. Click the iconto select multilingual masks.
  2. Choose the relevant mask for each language supported by window.
  3. Validate. The "Multilingual value" caption appears in the combo box for mask definition.

WinDev

Adjusting the size of the expanded combo box

To resize the expanded combo box:
  1. Select the Combo Box control in the window.
  2. Click the "Spin" button of the combo box. The mouse cursor turns into a vertical arrow. The expanded combo box is displayed as a dotted rectangle.
  3. Resize the expanded combo box with the black handle.
To resize the expanded combo box to the nearest pixel:
  1. Display the description window of the Combo Box control ("Description" from the popup menu).
  2. In the "Details" tab, specify the size (in pixels) of the expanded combo box ("Height" and "Width").
Notes:
  • By default, the width of the expanded combo box corresponds to the width of the input area in the combo box.
  • By default, the height of the expanded combo box is optimized according to the elements displayed in the combo box ("Height" set to 0 in the "Details" tab of the description of the combo box).
  • To allow the end users to resize the expanded combo box in the application directly (via the sizing handle of the expanded combo box), check "Resizable" in the "Details" tab of the description of the combo box ("Description" from the popup menu).
  • To store the size of the expanded combo box when the window is closed by the end user, check "Store the size" in the "Details" tab of the description of the combo box ("Description" from the popup menu). When the window is re-opened, the expanded combo box will be displayed according to the size that was stored.

WinDev

Drawing in the combo boxes

The drawing functions specific to the list boxes can be used to draw in the combo boxes or to display an image.

Note: If a row found in a combo box displays an image via 图示图片, when this row is selected, the image is re-used in the main row.

Vocabulary
To easily handle a combo box, you must be familiar with the following vocabulary:
NameDefinition
Selection barAllows you to view the element selected in the drop-down list. A specific color is used in most cases.
Browsing combo boxThe Combo box control is based on a data file or a query. The elements of the control correspond to the records of the data file.
Two types of browsing Combo box controls are available:
  • Browsing combo box "loaded in memory": The content of the control is loaded in memory then displayed in the control. Access to the Combo box control's elements is faster. This mode is reserved for the data files containing less than 100 000 records.
  • Browsing combo box in "direct access (no limit)": The control directly displays the content of the data file or query. The current record corresponds to the selected element. Each move performed in the control involves an access to the linked file. This type of combo box is reserved for data files containing more than 100,000 records.
Memory combo boxThe Combo box control is not based on a data file or a query. The elements displayed in the Combo Box control are defined by the developer (in the description window or by programming)
Editable combo boxThe user can enter text in the edit control associated with the combo box. If "Assisted input" is selected, the user can easily select the element by typing the first letters: the letters typed are automatically completed with the corresponding element.
Non-editable combo boxThe user selects an element in the list via the selection bar.

Swapping
WinDev WinDev allows you to automatically transform a standard combo box into a combo box with table (and conversely):
  1. Select the control to transform.
  2. Select the "Control .. Swap .. Combo box/Combo box with table" option.On the "修改" pane, in the "转换" group, expand "重构和切换" and select "Combo box/Combo box with table".

Example
Several preset Combo Box controls are proposed in the "Wizards, Examples and Components" pane:
  1. Click the "Controls" button found in the "Wizard, Examples and Components" pane.
  2. In the list of controls, click "Pre-fill control".
To include one of these controls in your window or in your page, "Drag and Drop" the control found in the "Wizards, Examples and Components" pane toward your window or your page.