Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use an oApp object
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00467798
Message ID:
00469393
Views:
13
Larry, thanks for your very helpful reply.

The reason I was moving it 'out' of the form, was to look forward a bit and to take account of a future scenario where I may be doing some validation on a back-end web server... I do not want to have to replicate/redesign all the validations

..just pass in the values.
I dont think this will be prcatical because a 'LOT' of detail on the form may have to be passed... I will end up with a lot of Parameters.. or is there another way of passing parameters.

Regards,

Gerard









>Gerard,
>You can two easy things:
>1. Move the code back ijnto your form class. This is OOP. Basically you are adding data services to forms. There is nothing wrong with this approach if you are going to stay with VFP 1- and 2- tier applications. The only time this could be problematic is if you attempt to handle multiple backends in a true n-tier way. Then the form-based approach presents limitations (IMO).
>2. Create a separate data validation object and add that to your form at run-time (or design time). This object would have the validation code in it and you could make calls to it. That way, contructs like THISFORM would work without a problem. However, if you wanted to make it truly separate, just pass in the values and have the object do the validation without any need to look at the form at all. This approach removes the coupling to the UI layer.
>
>You could modify option 2 to workj with your oApp approach but I wouldn't recommend it. This overloads the oApp object with functionality that shouldn't be there (IMO). The appilcation object should handle application wide items like what to do in case of application shutdown or application timer issues. It should not be validating data.
>
>Just my $0.02 USD.
>
>>I have an application object which I have a routine in to do screen validation
>>
>>In my screen , in the valid of my Save Button I do
>> oApp.MyValidate
>>
>>In oApp.MyValidate i have code which checks form properties
>> e.g. If ThisForm.Myproperty = 'Abc' .....
>>
>> but i get a 'object is not contained in a form' error message
>>
>>I had this code originally in a Form Base Clas method (and it worked fine) but took it out and put it into my Application object to make it more OOP, so that I could use the same code from other parts of the application.
>>
>>Are there certain things you cant do from an App object or have I missed
>>something in the coding.
>>
>>Regards,
>>
>>Gerard
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform