Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the best way of using forms, as .scx files or as objects?

Status
Not open for further replies.

RedLion

Programmer
Sep 13, 2000
342
NL
Hello,

In a book I read stood that you can better use forms as .scx files instead of using them as objects. Is this true? What's the opinion from you guys?

In some technical articles I read that you can better subclass all VFP classes, but when you do this you can't use forms as .scx files?????

Thanks,

Charl
 
Using forms as SCX files is MUCH easier to implement than as objects since you can see exactly what you're doing and the form will be (almost) exactly as you see it when it comes up.

If you subclass the main VFP classes, I believe it IS possible to still use them as SCX files. This is only theoretical, but I believe it might work. Give it a try.

The method used is to open the SCX file as a table with the command "Use Myform.scx". When you browse it, you will find a LOT of memo fields. You will need to locate the record for the form itself, most likely the 3rd record. Open the memo field "Class" and change it to the name of the subclass you created. Then see if it worked.

I recommend you backup your .scx and .sct files before you do this, though.
 
SCX-based forms can be subclasses, per Chpicker's comments. You'll also need to set the Classloc field to the path (or relative path) of your class library. Jon Hawkins
 
SubClassing the BaseForm and then again SubClassing that to an intermediary form to start with... is what I suggest.

This will help in n-tier applications building. Just putting all the codes in one form subclassed from VFP class is not the right approach. Again, the project size etc should guide you in deciding how many subclasses you make.

But... This definetely help even in our own building...
Example... I always subclass tSeries Class of forms from the main form and do all my trial build ups. If I do mess at any time.. I just clear that form and start again. Also previous codes can be easily avoided and new codes can be put in the subclassed trial ones, while the old codes do exist and are not participating in the trial generation. There are nnn number of advantages... one can think of.

So going with the word.. VISUAL.. and using it visual as classes or subclasses is the way I prefer. These again are of individual views .. There are surely places I find coding more easier..

The topic is so vast I cant put all my views in this short page...


ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
The main difference between a class form and an .SCX form is that the SCX form has a pre-determinable datasession.

You can select tables you want opened in this data session.

With a class you will have to use are techniques to accomplish this (most VFP frameworks use business objects to accomplish this.).

Business object are classes that handle data manipulation and business rules.

So as soon as you save an SCX form as a class you will loose the dataenvironment settings.

In my opinion going the OOP way is the best way to go, but it will cost you some time and effort to get the hang of it.
using forms (SCX), gets you on the way much easier, but does not have all the advantages of OOP (Code once, use in all subclasses).

Hope this helps,

Weedz (Wietze Veld) They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best. - Steve McConnell
 
Thanks all of you for answering my question,
So if the only disadvantage is that you can't use the visual dataenvironment settings in class (which I didn't use already), and as advantage have the possibilities as easy subclassing, and make a full OOP application and using the futures of it, I will go using forms as class.

Or some one should say no with a good reason :)

THANKS

Charl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top