Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is the deal with Combos?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00273965
Message ID:
00274250
Vues:
27
Yep. When the array is dimensioned [1, Length], it fails. So after it is initially populated in the init, I redimension as [Length]. The problem I see with reissuing the Query that populated the array in the first place is you then just removed any item that you added programmatically. I do not want any new list items added to the source table. The following is my final version of all the method code. It all works.

PROCEDURE Valid

This.Refresh()

ENDPROC

PROCEDURE Init

DoDefault()
select StaffName from travel!supers order by staffname into array This.aList
dimension This.aList(alen(This.aList, 1))
local lnResult
lnResult = 1
if !empty(This.ControlSource)
lnResult = ascan(This.aList, eval(This.ControlSource))
endif
if lnResult = 0
local lnLen
lnLen = alen(This.aList, 1) + 1
dimension This.aList[lnLen]
This.aList[lnLen] = eval(This.ControlSource)
This.NumberOfElements = lnLen
asort(This.aList)
endif
This.Requery()
return

ENDPROC

PROCEDURE Refresh

local lnResult, lcOldValue
lnResult = 1
lcOldValue = This.DisplayValue
if !empty(lcOldValue)
lnResult = ascan(This.aList, lcOldValue)
endif
if lnResult = 0
local lnLen
lnLen = alen(This.aList, 1) + 1
dimension This.aList[lnLen]
This.aList[lnLen] = lcOldValue
This.NumberOfElements = lnLen
asort(This.aList)
endif
This.DisplayValue = lcOldValue
This.Value = lcOldvalue

ENDPROC
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform