Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not understanding style=0 for ComboBox
Message
From
23/05/2007 19:14:41
 
 
To
23/05/2007 18:36:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01228009
Message ID:
01228098
Views:
14
>However, when I bring up this record again, the combobox is blank (it is >filled in correctly for values that match standard values). What do I do >so that the non-standard text saved in my field is visible in the combobox?
>
>Thanks

Hi James

Here is code we have in our lookup combo base class to do that:

In UIEnable of the Combo:
IF lEnable
	THIS.AddToComboList()

ENDIF
Then add this method:
***************************************************************************
*!*	Method:			AddToComboList
*!*	Purpose:		IF ROWSOURCETYPE = 6, Add non-valid item to view so user 
*!*					can edit.  Could be modified to handle other ROWSOURCE types.
*!*
*!*	Author:			bxk 2004.09.06
*!*	Parameters:
*!*	Returns:
*!*	Modifications:	
*!*					
***************************************************************************
LOCAL lnStart, luValue, lnEnd, lcColumn

STORE 0 TO lnStart, lnEnd
STORE "" TO lcColumn


WITH THIS
	IF !EMPTY(.cListView)
		IF EMPTY(.ControlSource)	
			luValue = ""			
		ELSE
			luValue = EVAL(.ControlSource)
		ENDIF
		
		luValue = IIF( VARTYPE(luValue) = 'C', ALLTRIM(luValue), luValue)
		IF !EMPTY(luValue) .AND. THIS.ROWSOURCETYPE = 6 && Fields
			lnStart =  ATC('.', .ROWSOURCE)
			IF .COLUMNCOUNT > 1		&& comma delimited list of fields
				IF .BOUNDCOLUMN = 1
					lnEnd = ATC(',', .ROWSOURCE)
					lcColumn = SUBSTR(.ROWSOURCE, lnStart + 1, ;
						lnEnd - lnStart - 1)
				ELSE
					lnStart =  ATC(',', .ROWSOURCE, .BOUNDCOLUMN - 1)
					lnEnd = ATC(',', .ROWSOURCE, .BOUNDCOLUMN)
					lcColumn = SUBSTR(.ROWSOURCE, lnStart + 1, ;
						lnEnd - lnStart - 1)
				
				ENDIF
			ELSE
				lcColumn = SUBSTR(.ROWSOURCE, lnStart + 1)
				
			ENDIF
			
			SELECT (.cListView)
			LOCATE FOR &lcColumn = luValue
			IF !FOUND()
				APPEND BLANK IN (.cListView)
				REPLACE (lcColumn) WITH luValue
				.SETFOCUS()
				.REFRESH()
				
			ENDIF
			
		ENDIF
	
	ENDIF
	
ENDWITH

RETURN
Previous
Reply
Map
View

Click here to load this message in the networking platform