Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ComboBox
Message
From
14/01/2017 09:47:24
 
 
To
14/01/2017 07:30:42
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01646654
Message ID:
01646681
Views:
49
>>>>Hi,
>>>>
>>>>In my combobox I face the problem that properties List, ListCount, ListIndex, ListId are not availble ("Expression could not be evaluated") and therefor a commandy
>>>>
>>>>For liLstcnt = 1 To This.ListCount
>>>>
>>>>results in error "Command is not recognized"
>>>>
>>>>I believe this is caused since I do a requery too early, combox is not yet fully instantiated.
>>>>Any idea how to check that properties are existing?
>>>
>>>PEMStatus() lets you check whether a property exists.
>>>
>>>My suggestion, though, is don't do call Requery both the combo is fully instantiated. What are you trying to do?
>>>
>>>Tamar
>>Hi,
>>
>>1) Pemstatus(This,'Listcount',5) returns 5
>>2) I am trying to built a combobox with a dynamical rowsource:
>>Thisform.cboCLUBS.RowSource = 'Select pcode from pstcode where address = m.lcCbo2 order by 1 into cursor curPostcode2 NOFILTER'
>>this is called from the form.setcombo, which is called from the cboCLUBS.gotFocus
>>Have meanwhile removed the requery from the init, no error "Command is not recognized" anymore, also no cursor in my combo, although in datasession I find the cursor available.
>>
>
>My "base" combo has calls in both Init and Requery to a custom GetItems method. Code to populate goes into GetItems. I've never had any problem with this.
>
>Tamar

Tamar,
maybe my basecombo is a copy of yours, otherwise it is a copy of the basecombo in 1001 Things.
Me too, never ever have had any troubles with it.
Now today, sorry yesterday, I faced this, for me totaly incomprehensible situation:
on calling requery()
which has following code in it:
Local llItemExists as Integer, ;
	lcAlias as String, ;
	lcFieldName as String, ;
	lcTable as String, ;
	lcTableName as String, ;
	lcValue as String, ;
	liLstID as Integer, ;
	liLstcnt as Integer, ;
	loSource as Object
	

lcTable = This.ControlSource
lcAlias = Alias()
Store Juststem(This.ControlSource) To m.lcTableName
Store Justext(This.ControlSource) To m.lcFieldName
Select (m.lcTableName)
loSource = This.ControlSource
lcValue = Evaluate(loSource)
*******************************
lItemExists = .F. && assume the value isn't in the list.
liLstID = 0
For liLstcnt = 1 To This.ListCount
	If This.List(liLstcnt) = m.lcValue
		llItemExists = .T.
		liLstID = liLstcnt
		Exit
	Endif
Endfor
If llItemExists
	This.Value = m.lcValue
Else
	If Empty(Alltrim(m.lcValue))
		This.Value = .Null.
	Endif
Endif

*******************************

lcValue = evaluate(This.ControlSource)

Select (m.lcAlias)
on line: For liLstcnt = 1 To This.ListCount it errors
and when I than look/examen This.List in my debugger I see the situation as in the first screenprint. Moreover pemstatus(This,'ListCount',5) returns .T.
The requery of the combobox is called in both the Form.init and in the Page3.activate. Have now first removed call from .activate and also from the Form.init, and all goes well, except, ofcourse my combobox is not showing the value of the ControlSource on starting - pitty, but suppose my user will have to live with that, unless of course you DHL me your laptop :)
However, joke's aside, do you have an idea what else I could use to determine This.ListCount is not given that error?
Thanks for replying
Koen
Previous
Reply
Map
View

Click here to load this message in the networking platform