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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a nice main.prg template

Status
Not open for further replies.

Mrall

Programmer
Nov 22, 2008
64
US
Looking for a nice documented main.prg template with the different sections defined and laid out blank or with commented examples. Such as define globale variable section, open databases, define functions, programming section, closing routines, and whatever else I may have missed. I'm surprised I have not seen any kinds of posting such as this. I realize this is pretty elementary, but a good start to programming starts with a good foundation. This is something that even though simple, will help anyone start with good programming structure. The Microsoft programmers book does not really touch on this matter.

Thanks for any help [bigsmile]
 
I use the following sequence in my Main.prg

*set commands and variables
*onshutdown commands
*Call Main Form
*Read Events
*cleanup code
**procedures used

This old world keeps spinning round - It's a wonder tall trees ain't layin' down
 
I don't program for the multi user business industry any more. My main intrest lies in the single user home PC (exclusive access). I do all of my own coding with which I don't intend for other programmers to modify. I provide runtime .EXEs for the end user. With the exception of a few classes that include Add, Edit, search, print and a few other unusual routines, I don't use a lot of classes. I do use few unusual forms and menus that I wouldn't use on a regular basis. (custom stuff) I don't use record locking and unlocking or user passwords or many other engineering type blueprints. I did back in 1985 through the early 90's I'm one of the first foxpro, mfoxplus and dbase II & III+ business designers. I designed some of the first popup menus before popup were added to the command language. Ya I'm old school. I just do this for fun. I just recentily purchased VFP6.0

I could write the main.prg templates myself, but some of you have be using Visual FoxPro alot longer than I have. I just though that maybe you would know what works best as far as a main.prg file goes.(keeping in mind my intended uses) The programming languages like (structured BASIC, COBOL, RPG, Fortran) all required the use of structured coding. The lines of code were placed in certain places within the program. (I know, because I wrote hundreds of business applications using them) The orignial FoxBase and Dbase had to be set up like this as well.

Once again, I am not the only person that would benifit from this info. We all know that someone else out there has had this though in their head but hasn't bother to ask. I think it's assumed that this is common knowledge. Show me in a book or online where a main.prg template is defined or even talked about in any detail. I know it was very important in the beginings before VFP (Is it just that unimportant now or does the business industry just not care?)

Thanks for any additional help
 
I know one of the main and really cool things about Visual FoxPro is it's ability to handle multi users. It's is a fourth generation programming language that can do just about anything. That's why, so far I like it, and I am using it. I also think it is easier than Visual BASIC. I probably use it when I should be using VB. For example (a countdown timer for timed card games) I don't need a database to count down to zero. Although now that you mentioned it a configuration database to go with it sound like a really neat idea.

If I understand you correctly I should make a database that retains all of the configurations for the system and programs. Such as system settings, screen colors, font info, working directories, screen size, and lots of other goodies. Of course, it would need to be modifiable by the user(s). or maybe not.

Thanks for you valable info.
P.S. TRS-80s and C64s were really cool at the time.
 
As professional business applications designers, is there any examples of program layout and design you would recomend to me or others to use to get started. Keeping in mind sometimes, we may wish only to make a simple program that display a picture or the time on the screen in some fancy format. (Ya I know this is below the true purpose and awesomeness that is VFP)

I have looked at the example business samples that come with FoxPro and the Programmer's guide and the ones that come with Enterprise Development Books. Of course, they all press the issues of business applications developement. Mulit-association fields records and databases. (Why not? That is the nature of VFP)

But what about designing maybe some of the simple things that arn't related to business like a Fancy Counter or a simple desktop Wigit. (So is VFP overkill, for the little things? I would like to think not.) I want to believe that I can design any program that I want, and know that I can do it with VFP. I also like the security that if I want to build an accounting system or even a Inventory/Customer database I can do that as well.

"One programming language to lead them all...."
Once again, Thanks for all your time and effort I really do admire your professionalizum.
 
Mrall,

Could I suggest that, rather than looking for a template, you sit down and write your own. You obviously understand the issues involved, and it's not exacty a huge piece of work to write a main program.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
White605's response is exactly the type of main program I write for my applications. I like to have the main form control the execution (event oriented rather than modal code). At most I'll have one additional procedure file that I declare which has my common procedures in it (procedures and functions that are common to all of my applications), though I have been setting up some of those functions as independent source code functions so I don't have to compile the entire procedure library for a smaller application.

Andy Snyder
SnyAc Software Services Hyperware Inc. a division of AmTech Software
 
Thanks guys! Your help is most appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top