Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Same old problem again
Message
 
 
To
15/12/2005 11:32:22
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
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:
01078218
Message ID:
01078327
Views:
30
>I didn't see such a behavior with comboboxes unless explicitly coded to do it. I don't understand why an unbound editbox 'save' its value.
>Cetin

It does not save. I have controlsource for the EditBox set in design time. Now in run-time I set it to an empty string. Once done that the EditBox loses its value immediatelly after loosing focus.

Here is the code in combobox Init method that adds an extra blank line if the list doesn't have blank value, but the value is blank (not in the list): [boundto property is set to false, boundcolumn is 2 for this class]
#define CRLF chr(13) + chr(10)

local lnSelect, lnRows, lnCols, laFields[1], ;
	lcCategory, lcSubcategory, lcDept, llReturn, lnI

lnSelect = select() && Save current alias

with this

	lcCategory = .cCategory_Description
	lcSubcategory = .cSubcategory_Description
	lcDept = m.goApp.cDept
** Make sure we always have data even in the wrong case
	dimension .aRowSource [1, 3]
	.aRowSource [1,1] = "<<No data returned>>"

	store "" to .aRowSource [1, 2], .aRowSource [1, 3]

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

	if not empty(m.lcCategory) && no point to execute the code if Category is empty
		if (.lDisplayAllRecords and Get_Viscodes_Records_By_Category(m.lcCategory, m.lcSubcategory, ;
				m.lcDept, .cCursorName , .f.)) ;
				or Get_description_from_Viscodes(m.lcCategory, m.lcSubcategory, ;
				m.lcDept, .cCursorName , .f., .iSystemFlag)

			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)

** This is going to execute assign method
				.lAddBlank = .lAddBlank

				.lAddAll = .lAddAll

				if .lAddAll or .lAddBlank
					if not empty(.controlsource)
						.listindex = 1
					endif
				endif
			else
				=ErrorMsg("The control " + .name + " does not return records. " + CRLF + ;
					"Please, contact the system administrator")
			endif

			.AdjustWidth()

		else
			=ErrorMsg("The control " + .name + " is not set up correctly. " + CRLF + ;
				"Please, contact the system administrator")
		endif
	endif

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

endwith
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