Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
New(?) combo weirdness...
Message
From
28/10/2009 17:24:36
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
18/12/2008 10:46:35
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01368493
Message ID:
01432100
Views:
227
>>>>Is the property value stored correctly in the SCX/VCX?
>>>
>>>It is not stored. Assigned in code.
>>
>>I guess most VFP native properties still have size limit of 255 characters.
>
>And the wisdom would be in knowing which ones may hurt :).

Definitely, the behavior has to do with the 255 char limit - in this case, of .rowsource, when .rowsourcetype=1 (Value). In the case I had today, rowsource string was 299 bytes long, and it not only truncated it at 255, it also left out two rows and part of the one before, and at runtime matched any blank field to the last available row (below 255) - because the missing part was the 2nd column (the bound one), so the last .

The workaround is a bit of code to list one row at a time and stuff it into .aList array of the combo... something like this
*[2009/10/28 16:39:48] ndragan - the bug 
*-- TEXT BLOCK BEGIN
	TEXT TO lcRows NOSHOW TEXTMERGE
option2,2
option3,3
option4,4
option5,5
...
option14,14
	ENDTEXT
*-- TEXT BLOCK END

	nrows=ALINES(al, lcrows)
	WITH .combo AS COMBOBOX
		.ROWSOURCETYPE= 5
		.ROWSOURCE="this.aList"
		.BOUNDCOLUMN=2
		.BOUNDTO=.F.
		nMax=.WIDTH
		nAvg=FONTMETRIC(6,.FONTNAME, .FONTSIZE)
		DIMENSION .aSource(nRows,2)
		FOR i=1 TO nrows
			lcRow=al[i]
			.aList[i,1]=GETWORDNUM(lcRow, 1, ",")
			.aList[i,2]=GETWORDNUM(lcRow, 2, ",")
*-- assume extra space by measuring uppercase
			nMax=MAX(nMax, TXTWIDTH(UPPER(" "+.aList[i,1]+"  "),.FONTNAME, .FONTSIZE)*nAvg)
		ENDFOR
		.COLUMNWIDTHS=TRANSFORM(ROUND(nMax,0))+",0"
		.REQUERY()
	ENDWITH

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform