PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Overview
  • Tip: How to refresh the content of an auto-filled Combo Box control that uses a query as a data source?
  • Initialization code from Combo Box control linked to a data file by programming
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Combo Box control linked 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:
  • 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:
  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.
// -- Initialisation d'un champ Combo
HExecuteQuery(MaREQ, hQueryDefault, Param1, Param2)
ListDisplay(COMBO_NomCombo, taStart)
Initialization code from Combo Box control linked to a data file by programming
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.
// -- Initialisation d'un champ Combo
HReadFirst(CLIENT, NomCli)
WHILE NOT HOut()
ListAdd(COMBO_Combo1, Client.NomCli)
HReadNext(CLIENT, NomCli)
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