How to Add combo box inside grid
How to Add combo box inside grid
(OP)
I have a grid as Grid1 and the columns are as below.
I want to add a combo box to the Delivery MODE column to select one value from the Delivery MODE list. How can I do this? please assist me..
Thank youÂ
CODE
Code Qty Delivery MODE 520B 100 521B 300 522B 500
I want to add a combo box to the Delivery MODE column to select one value from the Delivery MODE list. How can I do this? please assist me..
Thank youÂ
RE: How to Add combo box inside grid
1. In the Form Designer, right-click on the grid, and choose Edit.
2. Click in the Delivery Mode column (the column itself, not the header). You should now see the name of that column in the drop-down list at the top of the Properties window.
3. Select a combo box from the form designer's toolbar, or the Project Manager window, or the Toolbox, or whatever. Drop it in the column.
4. Nothing seems to have happened. In fact, the combo box has been successfully added, but it is obscured by the existing textbox, which is still present. (You can confirm this by looking at the drop-down list at the top of the Properties window.)
5. So, the next step is to remove the textbox: Select the textbox in the drop-down list at the top of the Properties window. Be sure that it's the textbox in the column which also has the combo box.
6. Click on the title bar of the Form Designer (not on the form itself; if you do, you will de-select the combo box). Press the Del key.
You should now see the combo box in the column in the form designer.
When you run the grid, you will only see the combo in the row that has focus, which is probably what you want. But if you want to see the combo in every row at the same time, then set the columns Sparse property to .F.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads
RE: How to Add combo box inside grid
Otherwise Mike has described the necessity to choose sparse or not. But removing the textbox is optional, so steps 5 and 6 in Mikes description are not mandatory, you can do something else, you can set the column currentcontrol to the combobox.
There's another complication to solve, if you decide to only show the combo in the active row of the grid, the other rows will show their textbox. Indeed it won't matter if you remove the default text1 textbox of the column or keep it in, in sparse mode the rows besides the active row will show a textbox. And that will not necessarily be able to show the selection you made in the combobox. That will depend on the controlsource you set up in the combo. If that's the key of a record of a table of delivery modes, and the combo is set to display the column with the delivery mode as text, the other rows will show the key, though, not the text.
The next topic will be how to design the combobox so it's compatible for grid usage. As the grid has to have a recordsource and in that deliver mode column has to have a controlsource of the delivermode text or key. That controlsource also has to be the controlsource of the combobox, but you can't make the delivery mode text a controlsource to a list of delivery mode texts.
Now there are several ways out of this dilemma, but the simplest is to set the column to not be sparse and instead show the combobox in every row, also the non-active rows, which means the combo will display the selection made on each row, also when you leave the rows.
The combobox in every row isn't very esthetic design, but it's just a matter of taste.
All in all, let this just be a warning that overcoming the problem to just add the combobox into the grid, it's not the last hard problem about the construct of a grid also usable for entering data, even just in your still quite simple case of picking a mode.
Chriss
RE: How to Add combo box inside grid
Tamar
RE: How to Add combo box inside grid
I might well be wrong about this. I am quite ignorant of the Toolbox.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads
RE: How to Add combo box inside grid
The Toolbox is incredibly cool and after using it for a lot of years, I wouldn't want to have to add controls to forms any other way. Here's my paper on why people should use the Toolbox: http://tomorrowssolutionsllc.com/ConferenceSession...
Tamar
RE: How to Add combo box inside grid
I didn't know that. A very useful feature.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads
RE: How to Add combo box inside grid
Tamar
RE: How to Add combo box inside grid
RE: How to Add combo box inside grid
Text scraps looks useful.
Regards
Griff
Keep
I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
There is no place like G28 X0 Y0 Z0
RE: How to Add combo box inside grid
Tamar