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

What goes where?

Status
Not open for further replies.

ArevProgrammer

Programmer
Apr 7, 2001
38
0
0
US
Hi,

In converting FoxPro 2.x screens to VFP, what in VFP becomes what it used to be in FoxPro 2.x for DOS. For example, where does the code from the Setup snippet, Procs snippet, Activate snippet and so forth get put in VFP?

I have a logon screen I need to convert in FoxPro 2.x to VFP that uses memory variables that does more than just log on a user. It performs a variety of tasks such as checking to see if the product has been tampered with, if the user is already logged in at another station and so on.

Any help would be appreciated.


Thanks to All,

Scott Rome was not built in a day. Be patient!
 
Some people use the main startup .PRG to initialize global type variables, and some use form properties or events like Init. The snippet code has been 'replaced' by the use of form methods. For form properties and methods, do this. After opening your form , go to the 'Form' menu selection. From there, you can either add or edit properties or methods pertaining to the entire form. Other method or event code, such as command button click events, can be added or edited by double clicking the control. You can then cycle through them using the PgUp or PgDn keys.

Dave S.
 
ArevProgrammer

You could create a global non-visual custom class that would hold the user login information (like user name- level of access etc.)Run the class a the beginning of your application (before the log-on screen)


oGlobal = CREATEOBJECT("custom")
oGlobal.AddProperty("Username")
oGlobal.AddProperty("Level")
oGlobal.AddProperty("Password")
ETC...
So when the user logs in Just store the info in the class
STORE Thisform.text1.value to oGlobal.Username
etc....
And the custom class will be available throughout the session.
 
Many people still use the program main.

from there do a splash screen

do a login form.

I think what you need os to know the firing order of a form and to start thinking OOP.

I suggest reading chapters 3,4 and 9 in the microsoft visual foxpro 6.0 programmer's guide.

for instance the load event of a form fires before the form or any of its controls is created. if you havn't used the data environment to automatically open tables the load method is the palce where you can prepare and manipulate data for for controls.
Attitude is Everything
 
ArevProgrammer

In regards to the snippets as DSummzz suggested they were replaced by events. All you need to remember is the initials L.I.S.A.G
L = LOAD **Before the form is created
I = Init ** The form is loaded at this point
S = SetFocus
A = Activate
G = GotFocus

 
You can get to the data environemnt by right clicking on the form, then select data environment.

the data environment has its own properties and methods to use. Attitude is Everything
 
VFP changed the names of a lot of events to be more VB like. A couple of other things to keep in mind are that there are now callable methods, a destroy event, setfocus, and lostfocus.

Procedures are now often user defined methods and are called with a =thisform.dothis type of command.

Variables are passed as parameters and only show up in the init area. Have to be moved to the screen's properties there or you end up with a lot of globals that take extra handling.

The valid event is also a bit of a pain in that you can't leave it to call a pick list. That has to be done in lostfocus.

Hope you make money on whatever you are doing. Good selling.

Bill Couture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top