Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Show Old Values in a List Box
Message
From
24/07/2001 06:05:23
 
 
To
24/07/2001 05:36:00
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00534266
Message ID:
00534270
Views:
14
Hi!

You can do this only by adding that item to the combobox list. There are a lot of pitfalls here, so better show you the code (I took it from the base class, I'm not sure it will work for you). Take a look specially to 'this.ControlSource=this.ControlSource' - when you try to assign to the Value property or do refreshing by another way, the control source field will be marked as changed. This code also fixes the mixed-case values that does not match between value in field and value in the list. The item is added to the list as disabled so user see that it is obsolete. You can also track here all disabled items and delete them as soon as they;re no longer needed. Beware about Enabled property of the combobox - when you use it, all items in combobox become enabled or disabled, so if you ever disable that combobox you require to use another approach to track items in the list by marking them in the special hidden column.
* Combobox.Refresh
* check that item exists and correct it proprly to value ignoring case, or add it
if vartype(this.Value) == "C" and !empty(this.ControlSource)
        local lFound, nitem, cValue, nFIndex, cOrValue
	m.lFound = .F.
	m.cOrValue = eval(this.ControlSource)
	if empty(m.cOrValue) or IsNull(m.cOrValue)
		return
	endif
	m.cValue = upper(allt(m.cOrValue))
	if this.ListIndex <= 0 or !(m.cValue == upper(allt(this.List[this.ListIndex,this.BoundColumn]))) && if not match with selected value
		for m.nitem = 1 to this.ListCount
			if m.cValue == upper(allt(this.List[m.nitem,this.BoundColumn]))
				m.lFound = .T.
				m.nFIndex = m.nitem
				EXIT
			endif
		endfor
		
		if m.lFound
			* fix value in inproper case
			this.List[m.nFIndex,this.BoundColumn] = m.cOrValue
			if !empty(this.ControlSource)
				this.ControlSource = this.ControlSource && to refresh List Index without changing value in table
			endif
		else
			* add value to list
			local nID
			m.nID = this.ListCount + 1
			THIS.ADDLISTITEM('\'+m.cOrValue, m.nID, 1)
			THIS.ADDLISTITEM('\'+m.cOrValue, m.nID, 2)
			THIS.ADDLISTITEM('\'+m.cOrValue, m.nID, 3)
			if !empty(this.ControlSource)
				this.ControlSource = this.ControlSource && to refresh List Index without changing value in table
			endif
		endif
	endif
endif
HTH.

>A client needs to use the List Box setting of the combo box but they
>also want the "OLD" values to be shown on the screen even tho they are
>removed from the drop down list. Is there any way to do this?
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform