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.

TDBComboBox doesn't shows the right value

Xailer English public forum
Responder
Gejza Horvath
Mensajes: 281
Registrado: Mar Ago 15, 2006 1:50 pm

TDBComboBox doesn't shows the right value

Mensaje por Gejza Horvath »

Hi,
the TDBCombobox control is linked into oDataSet1 into fiel CUSTNUM, (customer number is
type of CHR) and the displayed elements are filled with the next code from oDataSet3:
METHOD DBComboBox1Create( oSender ) CLASS TForm2
oSender:aItems := ::oDbfDataSet3:SaveToArray( "CustName" )
RETURN Nil
oDBComboBox1:nDataType is set to dtBOUND.
When oDBComboBox:lSort is .F., the control shows the correct customer name, but during the
Edit() method, the list of customer names are not sorted alfabetically. Setting
oDBComboBox:lSort to .T., the list of customer's name is sorted, but the displayed name is
wrong when the record changes in oDataSet1.
Please help, and sorry for so much questions, I'm testing how to do things in a new
environment.
Gejza Horvath
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9466
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

TDBComboBox doesn't shows the right value

Mensaje por ignacio »

Gejza,
You can not use the lsort property on the comboBox with nDataType to
dtBOUND, since its aItemsBound can not be updated accordly. We will supress
that property on next release or advice in the docs files. BTW you can sort
the array yourself first.
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=464b09bb@ozsrv2.ozlan.local...]464b09bb@ozsrv2.ozlan.local...[/email]
> Hi,
> the TDBCombobox control is linked into oDataSet1 into fiel CUSTNUM,
> (customer number is type of CHR) and the displayed elements are filled
> with the next code from oDataSet3:
>
> METHOD DBComboBox1Create( oSender ) CLASS TForm2
> oSender:aItems := ::oDbfDataSet3:SaveToArray( "CustName" )
> RETURN Nil
>
> oDBComboBox1:nDataType is set to dtBOUND.
>
> When oDBComboBox:lSort is .F., the control shows the correct customer
> name, but during the Edit() method, the list of customer names are not
> sorted alfabetically. Setting oDBComboBox:lSort to .T., the list of
> customer's name is sorted, but the displayed name is wrong when the record
> changes in oDataSet1.
>
>
> Please help, and sorry for so much questions, I'm testing how to do things
> in a new environment.
>
>
> Gejza Horvath
>
>
>
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Gejza Horvath
Mensajes: 281
Registrado: Mar Ago 15, 2006 1:50 pm

TDBComboBox doesn't shows the right value

Mensaje por Gejza Horvath »

Ignacio,
thanks for info, I found the next solution, a little bit difficult, but works fine:
METHOD DBComboBox1Create( oSender ) CLASS TForm2
LOCAL aNazov,i,aItems
aNazov := ::oDbfDataSet3:SaveToArray( {"Nazov","Kod" })
aNazov := ASORT(aNazov,,,{|x,y| x[1] < y[1] })
aItems := {}
FOR i := 1 TO LEN(aNazov)
AADD(aItems,aNazov[i,1])
AADD(oSender:aItemsBound,aNazov[i,2])
NEXT
oSender:aItems := aItems
oSender:Refresh()
RETURN Nil
Regards
Gejza Horvath
"Ignacio Ortiz de Zúñiga" <NoName@xailer.com> pí¹e v diskusním pøíspìvku
news:464b151e$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Gejza,
>
> You can not use the lsort property on the comboBox with nDataType to dtBOUND, since its
> aItemsBound can not be updated accordly. We will supress that property on next release
> or advice in the docs files. BTW you can sort the array yourself first.
>
> Regards,
>
> --
> Ignacio Ortiz de Zúñiga
> http://www.xailer.com
>
>
> "Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
> news:[email=464b09bb@ozsrv2.ozlan.local...]464b09bb@ozsrv2.ozlan.local...[/email]
>> Hi,
>> the TDBCombobox control is linked into oDataSet1 into fiel CUSTNUM, (customer number is
>> type of CHR) and the displayed elements are filled with the next code from oDataSet3:
>>
>> METHOD DBComboBox1Create( oSender ) CLASS TForm2
>> oSender:aItems := ::oDbfDataSet3:SaveToArray( "CustName" )
>> RETURN Nil
>>
>> oDBComboBox1:nDataType is set to dtBOUND.
>>
>> When oDBComboBox:lSort is .F., the control shows the correct customer name, but during
>> the Edit() method, the list of customer names are not sorted alfabetically. Setting
>> oDBComboBox:lSort to .T., the list of customer's name is sorted, but the displayed name
>> is wrong when the record changes in oDataSet1.
>>
>>
>> Please help, and sorry for so much questions, I'm testing how to do things in a new
>> environment.
>>
>>
>> Gejza Horvath
>>
>>
>>
>
>
>
Responder