Please help me with TDBComboBox! The situation:
The TDBCombobox named oCombo1 is placed on the form. I have a DBF table (oDbfDataSet1)
with simple structure:
Recno CISLO UCET
1. 01 122330002
2. 02 535535535
3. 03 837737737
I would like to
- display the items from field UCET in dropped combobox
- get the value from field CISLO for the selected UCET
- display the related UCET if I set the existing value from CISLO to oCombo1:Value
My existing and not working solution:
1. Fill the combobox with values from DBF in OnCreate() event of the combobox
oSender:aItems := ::oDbfDataSet1:SaveToArray({ "Ucet"} )
oSender:aItemsBound := ::oDbfDataSet1:SaveToArray({ "Cislo"} )
It's right, debugger shows the {"01","02","03"} in aItemsBound array from CISLO and the
corresponding {"122330002","535535535","837737737"} array from the field UCET in the
aItems array.
2. Setting the initial value from INI file
::oCombo1:Value := oIniPok:GetEntry("LIS","Cislo hlavneho uctu") // the value is "02")
3. oCombo1:nDataType := dtBOUND
oCombo1:nStyle := csDROPDOWN
oCombo1:lEnabled := .T.
And the problem: when the form is displayed, the oCombo1 shows "02" and clicking on the
control it don't drops down.
What is wrong, or generally: how to manage 2 arrays in combobox?
Gejza Horvath
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Simple ComboBox question
-
- Mensajes: 281
- Registrado: Mar Ago 15, 2006 1:50 pm
- ignacio
- Site Admin
- Mensajes: 9466
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Simple ComboBox question
Gejza,
1) You can not set any initial value to a Datacontrol, the value is
automatically assigned
2) You must perform a oDataset:Edit() in orde to access any DataControl.
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=460144e9@news.xailer.com...]460144e9@news.xailer.com...[/email]
> Please help me with TDBComboBox! The situation:
>
> The TDBCombobox named oCombo1 is placed on the form. I have a DBF table
> (oDbfDataSet1) with simple structure:
>
> Recno CISLO UCET
> 1. 01 122330002
> 2. 02 535535535
> 3. 03 837737737
>
> I would like to
> - display the items from field UCET in dropped combobox
> - get the value from field CISLO for the selected UCET
> - display the related UCET if I set the existing value from CISLO to
> oCombo1:Value
>
> My existing and not working solution:
> 1. Fill the combobox with values from DBF in OnCreate() event of the
> combobox
>
> oSender:aItems := ::oDbfDataSet1:SaveToArray({ "Ucet"} )
> oSender:aItemsBound := ::oDbfDataSet1:SaveToArray({ "Cislo"} )
>
> It's right, debugger shows the {"01","02","03"} in aItemsBound array from
> CISLO and the corresponding {"122330002","535535535","837737737"} array
> from the field UCET in the aItems array.
>
> 2. Setting the initial value from INI file
> ::oCombo1:Value := oIniPok:GetEntry("LIS","Cislo hlavneho uctu") // the
> value is "02")
>
> 3. oCombo1:nDataType := dtBOUND
> oCombo1:nStyle := csDROPDOWN
> oCombo1:lEnabled := .T.
>
> And the problem: when the form is displayed, the oCombo1 shows "02" and
> clicking on the control it don't drops down.
>
> What is wrong, or generally: how to manage 2 arrays in combobox?
>
> Gejza Horvath
>
1) You can not set any initial value to a Datacontrol, the value is
automatically assigned
2) You must perform a oDataset:Edit() in orde to access any DataControl.
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=460144e9@news.xailer.com...]460144e9@news.xailer.com...[/email]
> Please help me with TDBComboBox! The situation:
>
> The TDBCombobox named oCombo1 is placed on the form. I have a DBF table
> (oDbfDataSet1) with simple structure:
>
> Recno CISLO UCET
> 1. 01 122330002
> 2. 02 535535535
> 3. 03 837737737
>
> I would like to
> - display the items from field UCET in dropped combobox
> - get the value from field CISLO for the selected UCET
> - display the related UCET if I set the existing value from CISLO to
> oCombo1:Value
>
> My existing and not working solution:
> 1. Fill the combobox with values from DBF in OnCreate() event of the
> combobox
>
> oSender:aItems := ::oDbfDataSet1:SaveToArray({ "Ucet"} )
> oSender:aItemsBound := ::oDbfDataSet1:SaveToArray({ "Cislo"} )
>
> It's right, debugger shows the {"01","02","03"} in aItemsBound array from
> CISLO and the corresponding {"122330002","535535535","837737737"} array
> from the field UCET in the aItems array.
>
> 2. Setting the initial value from INI file
> ::oCombo1:Value := oIniPok:GetEntry("LIS","Cislo hlavneho uctu") // the
> value is "02")
>
> 3. oCombo1:nDataType := dtBOUND
> oCombo1:nStyle := csDROPDOWN
> oCombo1:lEnabled := .T.
>
> And the problem: when the form is displayed, the oCombo1 shows "02" and
> clicking on the control it don't drops down.
>
> What is wrong, or generally: how to manage 2 arrays in combobox?
>
> Gejza Horvath
>
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com