Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mostly working combo in a grid
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00260214
Message ID:
00260283
Views:
15
>I'm (finally) starting to do some UI programming (most of my work is backend work/HTML) and I can't seem to make this work. I've got a grid that has a combobox (List style) in it.
>
>The table populating the grid looks like:
>
>RLine
>------
>linenum : N(3,0)
>Desc : C(20)
>fk_dept : N(11)
>...
>
>The table used to populate the combo in the grid:
>
>All of the tables are actually views, so I set the RowSourceType to 6 - Fields.
>
>Dept
>-------
>iid : N(11)
>Department: C(20)
>
>RLine.fk_dept is linked to Dept.iid
>
>I want the combo box to display the "department" field of Dept, but save the iid into RLine.fk_dept. So I set-up the combo box so that:
>
>BoundColumn = 2
>BoundTo = .T.
>ControlSource = RLine.fk_dept
>RowSource = dept.department,iid
>
>The problem I'm having is that the combo displays the correct value when it's selected (it shows Dept.Department). However, when it's not selected it shows the actual key (RLine.fk_dept). I've tried changing the "parent" column's Control Source to RLine.fk_dept (among others), and setting the Bound property to .T., but it still displays fk_dept instead of Dept.Department or just plain doesn't work at all.
>
>Any ideas on what I'm missing here? Any really good builders I can use for this instead? ;-)


Unless you set the column's sparse property to .F., the grid is going to use the default textbox to display data in the rows that are not selected. Since the underlying data is an id, and not the descripion, this is what shows. When you bind a combobox to one field, and display the related field in another cursor, you are implementing an implied relationship. A plain textbox doesn't have this fliexibility.

Setting the column's sparse property to .F. will cause the combo to be displayed on every row. This might be visually unappealing, but I think it's your only choice to get exactly what you want.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform