Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combobox Capers
Message
From
15/08/1997 14:16:45
Bill Gravell
Indoor Purification System
Menifee, California, United States
 
 
To
15/08/1997 11:37:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00044699
Message ID:
00044991
Views:
41
>>>>>>>>If you are using a combobox that is bound to a field and you type something in the combobox, where does that value appear? When I look at the value property it is always "" unless I select an item from the list. I need to be able to either choose an item from the list or type in my own item (isn't that the definition of a combo-box?)
>>>>>>>
>>>>>>>Combo.DisplayValue
>>>>>>
>>>>>>I'm having the same problem!! And when my combobox loses focus, it's blank! Why?
>>>>>>
>>>>>>Elyse
>>>>>
>>>>>Because, you have to care about row soucre programmatically:
>>>>>*** Combo.Lostfocus event
>>>>>IF This.valueThis.DisplayValue
>>>>>*** add displayvalue to row source (or directly to field) here
>>>>>Endif
>>>>
>>>>Elyse & Michael: To expand on Edward's answer (correct as usual, Ed) VALUE is related to the table/cursor/array that is the recordsource of the combo. DISPLAYVALUE, however, has to do with what's showing on the screen. This is easier to see with a two-column combo where the bound column is 2.
>>>>
>>>>Personally, I've adopted the idea that's been tossed around recently for NOT having a combo bound if the user can enter data.
>>>>
>>>>Barbara
>>>
>>>Yes, I got understanding how combo works when struggled with my first multi-column combo. About the same time, I decided not to use ControlSource at all (I believe Barbara meant this saying 'NOT having a combo bound').
>>Once you've added your typed value to the rowsource, then you see it in the combo's list, right? That's not always a good thing. Can you consistently have a typed-in value stay in the box, after it loses focus, and not have that new value show up in the drop-down part when you click on it again?
>>
>>Not having solved that problem, I superimposed a textbox on a dropdown list and goofed it around until it worked.
>
>You can do both ways: add displayvalue (use this word, it's preciser) to row source (can be temp cursor, not a real table) in LostFocus (you know some users like click back and forth); or don't add and displayvalue is still in text portion (use this word, it's preciser), if you don't use controlsource property.

I fought this battle and found that IF I wanted to let the user add a value to the list use ADDITEM("displayvalue") (using the correct syntax, which I don't have in fromt of me right now) and then this.value = this.displayvalue. There are two versions of a dropdown combo...one that is designed to allow for user added items, and one that is not.

Bill
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform