Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box in grid

Status
Not open for further replies.

jawadfrhad

Programmer
Sep 4, 2017
25
IQ
hi all
i have cursor room(name c(1))
Includes
"a"
"b"
"c"
"d"
and i have cursor room2(name1 c(4))
Includes
'jun1'
'jun2'
'jun3'
'jun4'

Now i have grid
content combo box
i want ...
if room2.name1='jun1' display combo box =a
if room2.name1='jun2' display combo box =b
if room2.name1='jun3' display combo box =c
if room2.name1='jun4' display combo box =d
 
So you have four different combo box controls, all in the same column of the same grid? If that's right, you can use the column's DynamicCurrentControl property to choose which one to display:

Code:
* In the Init of the column
THIS.DynamicCurrentControl = ;
  "ICASE(room2.name1='jun1',  'ComboA', ;
    room2.name1='jun2',  'ComboB', ;
    room2.name1='jun3',  'ComboC', ;
    room2.name1='jun4',  'ComboD' )"

You might also need to set the column's Sparse proptery to .F.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I don't know, Mike. I think jawadfrhad just wants one combobox and a 1:1 relation between these 2 cursors.

They would need to have a relationship with a foreign key of the controlsource cursor relating to the primary key of the rowsource cursor. That's they way the combobox works with two cursors, one controlling the other, twoways, actually. The foreign key picks the record of the rowsource and you display that row as item. On the other side, choosing an item of the rowsource the controlsource field (the foreign key) is changed.

Such a (technical) primary/foreign key is usually not displayed and that's as easy as using the ColumnWidths property. That sets the widths of all columns of the rowsource with a comma-separated list of widths, which can contain 0 to hide columns. That way you can hide the key column.

So when the primary key is in the first column and what you want to display is in the second column of the rowsource cursor, then set columnwidths to 0,200. You'll not display the key column.

Chriss
 
Jawadfrhad, you posted this question twice. To avoid confusing things, could you please delete your other thread (thread184-1809887). You can do that by clicking the Delete button in the bottom right corner of your post.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank Mike Lewis for repeat me .... very Thank for you
I thank
I think I will present the same exercise but in a second form. I repeat my thanks to you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top