Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using combobox in grid issue
Message
From
06/10/2006 03:30:49
Walter Meester
HoogkarspelNetherlands
 
 
To
05/10/2006 15:04:52
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01159154
Message ID:
01159957
Views:
29
Hi greg,

I've done what you're trying to do a couple of times, but not in a grid, but here is what I would try. The key is to leave the controlsource empty (In the column you'll have to set bound = .f.). In the when, and or refresh, you'll have to put code like

DODEFAULT()
THIS.DisplayValue = v_option.name

In the valid, you'll have to explictly write the contents to the column:
REPLACE Name WITH THIS.DisplayValue IN v_option

Walter,






>>Style is combobox
>>
>>You mean style is 0-DropDown Combo? If so, what happens if you change the style to 2 - Dropdown List?
>>
>>Is the controlSource for the column that hold the combo v_option.model?
>>
>>There are no errors or indications there is a problem except that the data disappears. I have notice that if I have bound=.T. that the data does showup after I leave the record but then will disappear once you return to the record and it's never stored in the table. If bound=.F. then the data disappears as soon as you leave the record.
>>
>>This would indicate a discrepancy between the column's ControlSource and the contents of the combo's Internal list.
>
>
>Thanks for helping me work through this. I would have never believed something so simple could end up being so hard to pull off.
>
>The control source in the grid column that I want to populate is v_option.name. The view for the grid is restricted by model. For example, the v_option view used in the grid has a select that looks like: SELECT modeloption.name, modeloption.msrp, modeloption.webactive, modeloption.optionid from modeloption where modelid = ?vp_modelid. This gives a list of all options on the specific model.
>
>My combo box is populated with the following SQL: SELECT DISTINCT modeloption.name from modeloption where optionid=v_option.optionid. This gives me a list of the distinct option names across all models. I have a requery in the gotfocus to populate the combobox when the user clicks the control. The combobox is populating as expected.
>
>In my grid column v_option.name where I have dropped the combo box, I want the user to be able to type in an option name or select the option name from one provided in the combo box. Using a list style would not help me because the user would not be able to type in the control and could only select one from the list.
>
>I'm defintiely missing something obvious here. Do I have to manually do something when the user types in the combo box or selects an item from the list (like add the value property into the combolist) in order to get it write what is typed in to the underlying grid's controlsource? It's almost like the combobox is unbound from the grid and unfunctional except for the populated list. Anything typed in to the combobox just disappears as well as anything selected from the list. I've verified the controlsource in the column of the grid and it works fine with just a textbox. It would seem that dropping a combobox on the grid, even if the list were empty, that anything typed into the combobox would save the data just like as if it were a textbox. With all my experiments so far it has never saved anything that I've actually typed into the combobox.
>
>Thanks a bunch for your help!
>
>Greg
Previous
Reply
Map
View

Click here to load this message in the networking platform