Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cecil Champenois
  Where is Cecil Champenois?
 Little Elm
 Texas - United States
 Cecil Champenois
 To: Khaled Al-Najjar
  Where is Khaled Al-Najjar?
 Amman
 Jordan
 Khaled Al-Najjar
 Tags
Subject: RE: Freelance job
Thread ID: 330999 Message ID: 331016 # Views: 64 # Ratings: 3
Version: Visual FoxPro 9 Category: Jobs
Date: Sunday, December 25, 2011 5:48:37 PM         
   


> Hello Cecil,
>
> The due date for this project is one month, and i don't need to use any object oriented code inside it
> Cecil i build the project on VFP 9.0 but the problem in the connection to the DBF files that used to use the netware.plb but not in 9.0
>
> so what i need just to let the forms work with the dbf files
> and to let the new upgraded project to work with other languages (Arabic)

If you are not using a Database Container (look for a *.DBC file), then you have free tables, not connected to Database. You will want to open your tables in the LOAD event (Method) of each form that needs the tables. If you double click on the gray area of any empty form, you will see a list of events appear. You select LOAD.

You will want to set up a WAIT state, which FoxPro 2.6 also had to do, so that your forms don't go away as fast as they appear. I can give you some code for that.

Did the old system have a regular menu? If so, then you will need the same menu in VFP 9.0.

Remember, INIT is used to set things up for the other form-level objects (buttons, text boxes, combo boxes, grids, etc.), but not for data so much. The LOAD event is for setting up data (opening files).

Depending on how big a system this is, you could probably get this done in a month, but that is pretty short time. You would still need time to test everything. A month seems an awfully short time to me.

What I would do first is lay out your forms with the objects they will need first, so that you set things up just like they are in the 2.6 version. Get the forms to look just like the 2,.6 screens. Once you have accomplished that, then take the code that was used in the 2.6 version for each screen to open files, and put that into the LOAD event of each form.

You should use the Buttons' CLICK events for any actions you want to take, that match the buttons in the 2.6 version.

You will want a MAIN.PRG. You can call it anything you want, but it is advisable to have the WORD "MAIN" in it, and this should be the first program you add to the VFP 9 PROJECT.

I place an empty text file called DEV.TXT into the C:\Dev folder, and if that file is there, then I can see an extra menu item called "Exit to FoxPro" and that will let me exit the application directly into the FoxPro development environment, while it is still in development mode.

Here's some basic code for the MAIN.PRG file:
****************************************************************************************
* Main program for??? 
* VFP 9.0 Service Pack 2 Development
*
****************************************************************************************
* Program: MAIN.PRG
* Author : Cecil Champenois
* Date   : December 14, 2011
****************************************************************************************
_SCREEN.WINDOWSTATE = 2	&& Maximize window size.

PUBLIC oApp		&& Make the MemVar oApp publically available.
PUBLIC glDeveloper
STORE .F. TO glDeveloper

CLEAR ALL

IF FILE("C:\DEV\DEV.TXT")
	glDeveloper = .T.
ELSE
	glDeveloper = .F.
ENDIF

SET DELETE ON
SET SAFETY OFF
SET TALK OFF
SET EXCLUSIVE OFF
SET STRICTDATE TO 0
SET CENTURY ON
=NUMLOCK(.T.)

SET RESOURCE OFF
SET CPDIALOG OFF
CLEAR
SET STATUS BAR ON
SET CLOCK STATUS

DEACTIVATE WINDOW "Project Manager"		&& For developers only.
SET CLASSLIB TO SAMPLE.VCX
SET PATH TO K:\<font color="Blue">DATA
oApp = CREATEOBJECT("cAppObject")		&& Create the application object.
IF VARTYPE(oApp) = "O"
	* Calls the menu and sets up the READ EVENTS wait state.
	oApp.DO("SAMPLE FORM")
	RELEASE oApp	&& After a Clear Events, release the object, oApp.
	SET RESOURCE ON
	SET SYSMENU TO DEFAULT
ELSE
	MESSAGEBOX("Problem loading application...")
	QUIT
ENDIF

I then added an application object, made from a CUSTOM class. You can make a custom class to hold a program called simply "DO", as follows: (You do not need all of the below code.)
* Application Object to hold READ EVENTS (WAIT STATE) and menu handling code.
LPARAMETERS tcNameOfSystem
WITH This
	IF FILE(CURDIR() + "DEV.TXT")
		.lDeveloper = .T.	&& Means that the developer file was found.
					&& Developer gets more menu choices.
	ELSE
		.lDeveloper = .F.	&& Normal User logging in at his workstation.
	ENDIF
	.nTimeBegin=SECONDS()	&& Start timing system.
	.cNameOfSystem=tcNameofSystem
	PUSH MENU _MSYSMENU		&& Push the previous menu onto the memory stack.
	DO (.cMenu)			&& Execute the user-defined menu.
	_SCREEN.FONTNAME	= "FoxFont"
	_SCREEN.CAPTION		= .cNameOfSystem	&& + " - " + oApp.cFullName
	_SCREEN.CLOSABLE	= .F.
	_SCREEN.AutoCenter  = .T.
	_SCREEN.WindowState = 2
	WAIT WINDOW "Welcome to " + .cNameOfSystem + ". Elapsed time was " + ;
		ALLTRIM(STR(SECONDS() - .nTimeBegin,5,3)) + " seconds" TIMEOUT 1

	READ EVENTS		&& Put things into a wait state.

	DO CASE
		CASE .cExitMethod = "VFP"
			WAIT WINDOW NOWAIT "See you next time"
			* Restore the previous menu you saved earlier.
			POP MENU _msysmenu TO MASTER
			SET SYSMENU TO DEFAULT

			* Reset _SCREEN properties.
			_SCREEN.FONTNAME= "FoxFont"
			_SCREEN.CAPTION	= 'SAMPLE Form Development in VFP 9.0 SP2'
			_SCREEN.CLOSABLE= .T.
			CLEAR MEMORY
			CLEAR
			SET RESOURCE ON
			CLOSE DATABASES
			RETURN
		CASE .cExitMethod = "OS"
			@2,0 SAY "See you next time"
			CLEAR MEMORY
			CLOSE DATABASES
			QUIT
	ENDCASE
ENDWITH

And for the menu: I can send you a sample menu, if you'd like.

Usually, I set my FORMs to Autocenter=.T. There is a property in the Properties sheet for Autocenter. For Borderstyle, you can leave this as Sizeable (3) for the time it is being developed, so that you can change the width and height as needed, but once it goes into production, you will want to change this to Fixed-Single (1). The UNLOAD event is where you would want to close your form's tables. You can manually add properties to your form, which puts the properties at Form-Level for scope.

For the Form's WindowType property, you can set it to "MODAL" or "MODELESS" in the Properties Sheet. If it is set to MODAL, then while that form is in use (active), you cannot access the menu or any other form, which can be a good thing.

Cecil Champenois, Jr.

ENTIRE THREAD

Freelance job Posted by Khaled Al-Najjar @ 12/25/2011 1:45:34 PM
RE: Freelance job Posted by mk sharma @ 12/25/2011 3:59:47 PM
RE: Freelance job Posted by Khaled Al-Najjar @ 12/25/2011 4:12:57 PM
RE: Freelance job Posted by Cecil Champenois @ 12/25/2011 5:15:41 PM
RE: Freelance job Posted by Khaled Al-Najjar @ 12/25/2011 5:27:44 PM
RE: Freelance job Posted by Cecil Champenois @ 12/25/2011 5:48:37 PM