Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LstListNavigator
Message
From
25/10/2002 12:45:18
 
General information
Forum:
Visual FoxPro
Category:
CodeMine
Miscellaneous
Thread ID:
00715384
Message ID:
00715523
Views:
19
>I have placed a grid (grdGridCustom) control on the form, and edited the two columns to use CodeMine txtTxtBoxCustom controls per the doc's. I set lRefreshOnRowChange to .T. per doc's, and its cWorkArea to the child table. In column 1 I set the ControlSource to mychildtable.category. Would I set column 2 to mygrandchild.descript or what?

Make sure that your grid's recordsource is set to the child table. In column 2 of the grid, set its control source to a form.method you are going to create, say Thisform.grandChildDescript(). So, in column2's control source, literally type :- Thisform.grandChildDescript() - don't put quotation marks or anything like that around it. Create the form method and in it, type code similar to the following. Remember that I dont know what the relationship details are between the child and the grandchild tables but you can improvise.
if seek(mychildtable.categoryid, 'mygrandchild', 'categoryid')
   *-- Find the related grandchild record and return its "description".
   return mygrandchild.description
endif
*-- Record not found, which is unlikely, but if so, just return the empty string.
return ''
Remember that each row in the grid for a moment is the "current" row in the child table. When column #2 tries to evaluate the method name that is its control source, the method uses the child data in the "current" row to seek back to the related record in the grandchild table. So, for each row in the grid, a single seek() is performed on the related table. You cannot rely on the relationship between the cursors. You must seek (or locate) and return a value.

HTH
-=Gary
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform