Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to show value not in rowsource of the combobox
Message
From
22/10/2003 18:06:57
 
 
To
22/10/2003 16:28:45
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00753822
Message ID:
00841346
Views:
23
Hello Suzi.

I, unfortunately, do not have KiloFox so I cannot check out Chapter 5.

Actually, you can still check out the text because chapter 5 is available as a free download from the sample chapters at www.hentzenwrke.com. Unfortunately for you, the code is not inclued with the free sample chapters, but quite a lot of the code is available in the text.

I have a common form that is used by multiple locations and the combobox on it lists employees only for the given location. However, an employee previously selected via the combobox may subsequently switch locations or leave the company altogether, in which case I would still want to display the historical value even though it may not currently be included in the RowSource list.

You need to set up the combo box as Style = 0 - Drop Down Combo and add a custom property called cControlSource and a custom method called RefreshDisplayValue to the combo. In the combo's init(), you need to unbind it behind the scenes like this:
IF DODEFAULT()
  WITH This
    .cControlSource = .ControlSource
    .ControlSource = ''
  ENDWITH			
ENDIF

Call RefreshDisplayValue() from the cmbo's Refresh(). This code in RefreshDisplayValue():
LOCAL lcControlSource
WITH This
  IF ! EMPTY( .cControlSource )
    lcControlSource = .cControlSource
    .DisplayValue = &lcControlSource 
  ENDIF
ENDWITH	
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform