|
|
|
|
- Overview
- Tip: How to refresh the content of an auto-filled Combo Box control that uses a query as a data source?
- Initialization code of a Combo Box control programmatically linked to a data file
Linking a Combo Box control to a data file
A List Box or Combo Box control can be used to display the content of a data file, to allow a user to select a record, for example. A Combo Box control can be initialized with the content of a data file: - automatically: No specific code is required to initialize the control. The options to loop through the data file linked to the control can be defined in the "Content" tab of the control description.
- programmatically: The code used to loop through the data file linked to the Combo Box control must be entered in the initialization code of the control. This method is not recommended.
Remark: When creating a Combo Box control, the wizard will ask for all the details required to link the control to a data file. Tip: How to refresh the content of an auto-filled Combo Box control that uses a query as a data source? If you are using a Combo Box control based on a query with automatic initialization, to refresh the control content, type the following code (in the initialization code of the control for example). This code performs the following operations: - Execute the base query of the Combo Box control again (specifying the query parameters, if necessary) with HExecuteQuery.
- Display the content of the Combo Box control again with ListDisplay.
// -- Initialization of a Combo Box control HExecuteQuery(MyQRY, hQueryDefault, Param1, Param2) ListDisplay(COMBO_ComboName, taStart)
Initialization code of a Combo Box control programmatically linked to a data file If you use a Combo Box control based on a data file with programmed initialization, you must write the code to loop through the data file in the control initialization code. For example: Initialization of a Combo Box control with the customers of the CUSTOMER data file. // -- Initialization of a Combo Box control HReadFirst(CUSTOMER, CustName) WHILE NOT HOut() ListAdd(COMBO_Combo1, Customer.CustName) HReadNext(CUSTOMER, CustName) END
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|