Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Populating grid through edit form
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00382529
Message ID:
00382563
Views:
16
>Hi,
>
>
>Alex = creatobject("desperados")
>
>
>I have a form that has a grid that's populated with records matching the main bizobj's primary key:
>
>
>
>Requests (main)
> |
> +--- Treatments (child)
>
>
>
>On this form the treatments appear as a list in a grid.
>
>I created another form based on cBizObjModalForm that's called whenever the user double clicks on any of the entries on the grid.
>
>All this form has is a textbox and an OK and Cancel buttons. This daughter form uses the default datasession (provided by the main form), and the textbox's datasource is v_treatments.desc.
>
>So far so good. (yea, so far, otherwise why would I be posting this?).
>
>Then I added an "Add" button next to the grid that appends a blank record in v_treatments and calls the modal form.
>
>I'm able to enter treatments there, and they somehow make it to the table, BUT I don't know where to put the code to add the foreign key to the treatments table (or the v_treatments view to that effect).
>
>I tried to call thisform.save() from the child form's OK button, but presavehook() never gets called, which is where I originally placed
>
>
>replace requestiid with v_requests.iid
>
>
>So, what's the trick here?
>

When I have a need to design a grid that goes into a form for editing, I use the cListObjEdit object and the cListobjEditForm class for the editing. I put the foreign key information in the form's PreSaveHook method like you show above but I also use the IN clause to make sure the correct table is being used. This works just great and it seems to use the form and class intended by the framework. The cListObjEditForm is a modal form and is generic enough to design it the way you need for most situations.

Hope this helps.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform