Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Listbox in grid problems
Message
From
08/10/1997 13:38:36
 
 
To
08/10/1997 12:58:58
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00053462
Message ID:
00053743
Views:
22
>>>I have a grid which has two related columns, the second is a listbox.
>>>I am trying to set the rowsource of the listbox programmatically in it's dropdown event. The values in the list are determined by the value of the first field in the same row.
>>>
>>>cboPayors.dropdown
>>>
>>>LPARAMETERS nindex
>>>*-- create a cursor for the Payor drop-down list of Owners of this Folio
>>>
>>>lcFolio = THIS.parent.parent.column2.txtFolio_id.value
>>>IF NOT EMPTY(lcFolio)
>>> THIS.RowSource = ;
>>> "SELECT F.OWNER_ID, O.LAST_NAME, O.FIRST_NAME FROM FOLIOOWNER F, OWNER O " + ;
>>> "WHERE F.FOLIO_ID= '" + lcFolio + "' AND " + ;
>>> "F.OWNER_ID=O.OWNER_ID INTO CURSOR cPayors NOFILTER"
>>>=messagebox(this.RowSource)
>>>ENDIF
>>>
>>>
>>>From the messagebox, I can see that the value of txtFolio_Id being used to build the SELECT statement is NOT that of the currently selected row, but that of the previously selected row, despite the record mark indicating the current row.
>>>
>>>How do I ensure I am using the value of the Folio_Id field which is on the same row as the listbox just clicked ??
>>>
>>>A related Q - in some examples of drop-down lists I've seen, clicking on the field causes the list to drop, in others the use has to click on the down arrow. What is causing this difference in behaviour?
>
>
>>This is generic recommendation: it's much better to use cursor's alias as Grid.Recordsource, because here you can always check >record field value when you move grid (record) pointer.
>
>I am using the cursor's alias as grid.recordsource. I guess I should have noted that the grid is for the child table on the form.
>I tried setting relationships in the dataenvironment i.e. grandparent -> parent -> child ( and not setting the listbox.rowsource programmatically as in the code above), but the drop-down list then includes ALL of the child records for all of the parents - not just those of the current parent.
>Surely there is a way of getting the value of a particular field on the active row?
>
>Martyn

If you have cursor as a recordsource, then just check for appropriate cursor field value, which is always associated with active grid row==cursor record.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform