Is it possible to use combo box inside a grid, for selected columns? The
reason is I wanted to limit the user to the number of possible value that
the user can choose, therefore fixing the value for selected columns to only
what are defined. For example, for the field length, I only want the user to
be able to enter these values: 1016, 1064 and 1240.
Yes, you can actually add every VFP control class to a Grid.Column -
either programmatically at runtime, e.g. in yourGrid.Init():
With This.ColounX
.NewObject('Combo1','yourClass')
.Combo1.Visible = .T.
.CurrentControl = 'Combo1'
.Sparse = .F. && new control appears in every row at runtime
EndWith
or visually in the Form/Class Designer:
activate the desired form.grid.column in the Properties window
add your desired class from the Controls toolbar
modify column.CurrentControl
optionally set column.Sparse
FWIW, in my experience, Comboboxes inside Grids work best with
a cursor-less RowSourceType like 5 or 0 or 1
hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
"Stefan Wuebbe" <stefan...@gmx.de> wrote in message
news:e6NswndM...@TK2MSFTNGP04.phx.gbl...
- Select the unwanted control in the properties window;
- click on the top border (the title area) of the form; and
- press the Delete key.
A combo box is a list box which allows text entry. If you want to
block text entry, use a list box.
- Rush
I am so sorry, Foxpro is like a stranger to me.
When I used a listbox, these are the problems I faced: a. The height of the
listbox is confined to the height of the row in the grid, thus not able to
achieve the result of a 'drop-down' where I can see the list and choose
among the items. b. when i choose any item in the list and move to the next
field, the selected item isn't displayed in the listbox's column. For
example, in the grid I have column1 for productcode, column2 for
productdescription, column3 for thickness, column4 for width, column5 for
length, etc. The listbox I put under column1, when I select a productcode
from the list and move to column2, I expect the productcode to display at
column1's field. When I did this, the field is still blank.
Another question I would like to ask is how do I get the fields in other
columns being automatically entered when I choose the productcode in
column1. For example, if I choose a productcode called PP20, the column2's
field auto display "Polypropylene 20micron" (the productcode and description
are 2 columns in the product table, so whenever I choose a productcode I
want the corresponding descriptionto be automatically entered in column2),
the column3 display 20. Oh yes, how to extract the 3rd and 4th character
from column1 current productcode and assign it to column3, something like
the Instr in visual basic?
"Rush Strong" <rush.strong@[DELETEME]verizon.net> wrote in message
news:ed9o4qmM...@TK2MSFTNGP02.phx.gbl...
You are welcome. As Rush already said, you can activate the control
you want to remove in the Properties window and then activate the
Form Designer window's tiltlebar and hit the <Del> key.
> Another question is how do I set the combobox so that user can only choose the values
> populated inside the combobox and not allow keying-in on the textbox portion of the
> combobox, or must I only use listbox?
Does combo.Style=2 do what you want?
As Stefan said, Style = 2 in a combobox gives
you a dropdown list instead of a combo, so
you can only choose from the list, not type.
Bye, Olaf.
- Rush