Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Difference between forms and class based forms?
Message
From
25/03/2009 08:56:18
 
 
To
25/03/2009 08:33:05
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01391221
Message ID:
01391339
Views:
105
Doug --

Thanks for your examples. I can see how those differences (not significant, in my humble opinion) could make a difference at times.

BTW -- I find the solution for modal forms kind of curious -- since when am I supposed to know about the names of properties in a called form?

>Hi Jim.
>
>>What's the functional difference between a form and a class based form?
>
>I have a mixture of SCX and VCX forms in some projects and there are pros and cons for both:
>
>- It's a little less code to run an SCX form: DO FORM rather than NEWOBJECT() followed by Show().
>
>- As others have pointed out, SCX forms have a DataEnvironment you can set up at design time. I don't consider this to be a huge advantage because DEs limit you to some extent.
>
>- VCX forms have more flexibility: you can set properties and call methods prior to calling Show().
>
>- This may just be personal preference, but I like using code like this to get values from a modal form:
>
loForm = createobject('MyModalForm')
>loForm.Show()
>if vartype(loForm) = 'O'
>    lcVar1 = loForm.cProperty1
>    lcVar2 = loForm.nProperty1
>endif
For this to work, the OK button in the form calls Thisform.Hide() while the Cancel button does Thisform.Release(). Getting multiple values from a modal SCX form means passing in a parameters object, which is more work setting up and filling with values.
>
>- You can subclass a VCX form if you come across the need for a variant under some conditions.
>
>I'm finding more and more that I prefer VCX forms (which you can probably tell since I wrote the code you used as an example <g>). For example, one thing I'm doing right now is automating screen snapshots (using GDIPlusX) for documentation. For that to work, the forms must be modeless: show the form, take the screen shot, release the form. That's easily handled with VCX forms; even if WindowType is 1-Modal, just call loForm.Show(0) to make it modeless. No can do with SCX forms, so now I'm having to go back and convert my SCX forms into VCX forms for this to work. This is a pretty unusual situation <g>, but indicative of the flexibility VCX forms have over SCXs.
>
>Doug
Jim Nelson
Newbury Park, CA
Previous
Reply
Map
View

Click here to load this message in the networking platform