Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Difference in combobox behavior depending on source
Message
 
 
To
20/10/2005 16:44:49
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01060796
Message ID:
01060880
Views:
11
>>If my combobox rowsource is an alias and the initial value is blank (not in >the combobox rowsource), when I expand the combobox, I see all the records >from my alias and nothing else. However, if the rowsource is an array and >the initial blank value doesn't exist in this array, I see an empty record >added at the bottom of my selections. Once I selected a value, this blank >record is gone. Why there is such a difference?
>
>Hi Naomi, how do you populate the array? i've done many combo with array by rowsorce and this not happen.

Here is cboVisCodes Init method:
local lcCategory, lcSubcategory, lcDept, llReturn, lnI
llReturn = .t.
if !dodefault()
	llReturn = .f.
endif

if m.llReturn
	local lnSelect, lnRows, lnCols, laFields[1]
	lnSelect = select() && Save current alias
	with this
		lcCategory = .cCategory_Description
		lcSubcategory = .cSubcategory_Description
		lcDept = m.goApp.cDept

		if empty(.cCursorName)
			.cCursorName = "c_VisCodesLookup"
		endif

		if Get_description_from_Viscodes(m.lcCategory, m.lcSubcategory, ;
				m.lcDept, .cCursorName , .f., .lSystemFlag)
			
			lnRows = reccount(.cCursorName)

			if m.lnRows > 0 && our cursor does have rows

				select (.cCursorName)
				lnCols = afields(laFields)
				dimension .aRowSource [m.lnRows, m.lnCols]
				copy to array .aRowSource

				select (m.lnSelect)

				if .lAddBlank
					dimension .aRowSource[ALEN(.aRowSource,1)+1, m.lnCols] && add one more column
					ains(.aRowSource,1) && inserts a row
					for lnI =1 to m.lnCols
						store space(1) to .aRowSource [1, m.lnI]
					next
				endif

				if .lAddAll
					dimension .aRowSource[ALEN(.aRowSource,1)+1, m.lnCols] && add one more column
					ains(.aRowSource,1)
					for lnI =1 to m.lnCols
						store iif(m.lnI = 1, "<<All>>", "") to .aRowSource [1, m.lnI]
					next
				endif

				.rowsourcetype = 5 && Array
				.rowsource = "This.aRowSource"

				if .lAddAll or .lAddBlank
					.listindex = 1
				endif
			else
				llReturn = .f.
			endif
			if not .lSavecursor
				use in select(.cCursorName)
			endif
			.AdjustWidth()
		else
			llReturn = .f.
		endif
	endwith
endif

return m.llReturn
Suppose, my field value is blank and I do not have blank values in the array (lAddBlank property is false). When I expand the array this empty value shows at the end.

What I'm doing wrong here?

Thanks.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform