ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Combo Box control
  • Overview
  • Tip: How do I refresh the contents of an Auto-filled Combo Box control whose source is a query?
  • Initialization code of a Combo Box control programmatically linked to a data file
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Linking a Combo Box control to a data file
Overview
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:
  • or automatically no specific code is required to initialize the field. The options to loop through the data file linked to the control can be defined in the "Content" tab of the control description.
  • or by programming You need to enter the path code of the data file linked to the Combo Box control in the field initialization code. This method is not recommended.
Note When creating a Combo Box control, the wizard asks for the information required to create a Combo Box control linked to a data file.
Tip: How do I refresh the contents of an Auto-filled Combo Box control whose source is a query?
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:
  1. Execute the base query of the Combo Box control again (specifying the query parameters, if necessary) with HExecuteQuery.
  2. 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 clients from the CLIENT data file.
// -- Initialization of a Combo Box control
HReadFirst(CUSTOMER, CustName)
WHILE NOT HOut()
	ListAdd(COMBO_Combo1, Customer.CustName)
	HReadNext(CUSTOMER, CustName)
END
Minimum version required
  • Version 9
This page is also available for…
Comments
//COMBO PROGRAM + QUERY DESIGN + FILTER DYNAMIC
//a) Insira um combo na tela

//b) click com o direito do mouse e escolha a opção CONTENT

//c) Escolha tipo "Table" vai liberar o Botão [Edit The Columns...]

//d) Informe as colunas que deseja ter no combo

//e) Ainda em CONTENT, Source Informe a coluna que será visivel do controle

//f) Em Details, Marque a opção Editable Combo box [x]

//g) Coloque um botao e esse código abaixo:

QRY_Select_T015_Empresas_Filtro.ParamEmpresaID = gsProfissionalXEmpresas

HExecuteQuery(QRY_Select_T015_Empresas_Filtro, hQueryDefault,gsProfissionalXEmpresas)

ListDeleteAll(COMBO_QRY_T015_EMPRESAS_FILTRO)

FOR EACH QRY_Select_T015_Empresas_Filtro
ListAdd(COMBO_QRY_T015_EMPRESAS_FILTRO,QRY_Select_T015_Empresas_Filtro.T015_COD_EMPRESA +TAB+ QRY_Select_T015_Empresas_Filtro.T015_DESCRICAO)
END
BOLLER
12 Apr. 2019

Last update: 12/05/2024

Send a report | Local help