Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Playing With Codebook: Some Simple Stuff
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00059273
Message ID:
00059432
Views:
28
Michael,

Are you using VFP3 Codebook or VFP Codebook for Mere Mortals? Since I didn't spot you in our customer list, I'll assume you're using VFP3 Codebook.

>Just playing around with Codebook once again and was wondering about some simple stuff. I have two views, consigne and address. Consigne is a view without any view parameters. Address is a view with one view parameter, vp_key, which relates back to co_key in consigne. Thus, consigne has a one-to-many relationship with address.

>I've created two business objects, bizconsigne and bizaddress. Bizconsigne is a onetomanybizobj and bizaddress is a bizobj which is placed on bizconsigne. Now, the problem is this: When I instanciate the form this bizobj is on and requery, prev, next, top, etc., the VFP view parameter request box for address always pops up. Obviously this is because vp_key hasn't been defined anywhere. I could put custom code in the Requery() method to assign vp_key before the child is requiried, but if I do that I'll have to put custom code in every navigation method method. Not a very time saving approach.

>Is there a better approach to this whereby vp_key can be linked to co_key so vp_key will not have to be assigned each and every time?

Actually, since you used COneToManyBizObj for BizConsigne, the navigation methods (Next(), Prior(), First(), Last()) automatically requery the child business object. So if you placed code to set the view parameter in the child's Requery() method (don't forget to DODEFAULT() or COneToManyBizObj::Requery() in the Requery() method) it would always be called by the different navigation methods.

In our Mere Mortals framework we have created a scheme that uses a business object array property to specify view parameters and their values. This array is checked in the business object's Requery() method before the REQUERY is executed. If there are any view parameters specified, they are assigned the corresponding values. We have a business object PostInitHook() in which the developer can place code to initialize the view parameter array.

Regards,
Kevin McNeish
Oak Leaf Enterprises Solution Design, Inc.
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Reply
Map
View

Click here to load this message in the networking platform