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

how to start 2

Status
Not open for further replies.

nguntay

Programmer
Oct 5, 2004
20
TR
I am an old programmer of foxpro 2.5 for dos.
Recently purchased vfp9.
since one week, triying to figure out how to use read events command.
Badly need help to write a program that simply adds to numbers (on two textboxes) on a form tru a command button , so that I can figure out the use of "read events" command with in a form.

thanks to Microsoft, they made it so simple to start with that tasmanian project so that every one can learn within a century without help (!).
 
I assume you have the 2 text boxes. Make sure you have them set to be numeric.

double click on the button, you will be in the dblclick event of the button.

nNum1 = thisform.text1.value
nNum2 = thisform.text2.value
nTot = nNum1+nNum2
messagebox(nNum1)

Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 
thanks for reply Ali,
but where is the "read events" command ?
 
sorry, the above should be:

messagebox(nTot)

:) sorry

Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 
Oh don't be sorry for that Ali ,it is obvious
but come to my point of question.
I will try to convert 100,000 lines of code of a whole accounting package to vfp9 .And don't even know how to use read events command within the form. Imagine my dissappointment.
 
I made my first executable. But it denies to close...
Why..?
 

When program runs within the project maneger, it shows the form , but when built into the executable, it doesnot show up the on the screen. ?
 
From my own experience as "old" foxpro dos programmer:
Get an example (a small vfp project) and have a look at it to figure out how things work....
Forms are quite different from anything you saw in the old foxpro dos, but it is worth the effort!

Good luck guys!

Rob.
 
Dear rob444,

that is exactly what I need.
But where to find a small vfp project. ?

your advice highly appreciated.

many thanks any way.
 
How come an application shows up on the screen when run in the project manager but hides (become invisible) when it is built to a win32 executable and then executed. ?
 
nguntay,

There are many possible projects to have a look at.
For example the samples that visual foxpro includes in the samples directory and in the tools\xsource directory.

This forum has many examples that can be usefull.
Also have a look at the links that this forum provides, enough resources for many projectfiles to have a look at.

Good Luck!

Rob.

 
nguntay,

After having created a projectfile make sure you have a program that is the first program to be run - a main program that calls your menu(s) or form(s)

A simple example is:

*** MAIN.PRG
******** SETTINGS *******
SET TALK OFF
SET ECHO OFF
SET CENTURY ON
SET DELETED ON
SET SAFETY OFF
SET SYSMENU OFF
SET STATUS BAR OFF
SET SYSFORMATS ON
SET EXCLUSIVE OFF
SET MULTILOCKS ON
_SCREEN.fontname = "Lucida Console"
_SCREEN.fontsize = 14
_SCREEN.maxheight = 720
_SCREEN.MaxWidth = 980
_SCREEN.autocenter = .T.
******** SETTINGS *******
******** DECLARATIONS *******
******** DECLARATIONS *******
******** PROGRAM BODY *******
CLEAR
DO menu.mpr
READ EVENTS
CLOSE ALL
RELEASE ALL
CLEAR EVENTS
QUIT
******** PROGRAM BODY *******


In this example you see "do menu.mpr", and in the project you'll need to have a menu called menu.

Good Luck!
Rob.
 
nguntay,

Converting an accounting program of over 100.000 lines to vfp9 will be quite a job.

Accounting programs usually use lots of screens.
If the fp2.5 code contains lots of those fp2.5 screens you'll probably need to create new screens in vfp9.

Another way to get the package running in vfp9 is to use the generated screen files (those are in fact prg's) and run them in vfp9.

In most cases that will function.

If you want more dialog on this subject you can email me at:

n o c u r e A T h c c n e t D O T n l
without the spaces of course...

Rob.
 
The problem you describe (an app that runs from the Command Window, but not as an EXE) is that you don't have a wait state in your application.

Once you do everything that should happen on start-up and you're ready for user input, issue READ EVENTS. In whatever code runs when the user wants to shut down your application, issue CLEAR EVENTS.

Tamar
 
Dear Rob444

here is the code.

*** MAIN.PRG
******** SETTINGS *******
SET TALK OFF
SET ECHO OFF
SET CENTURY ON
SET DELETED ON
SET SAFETY OFF
SET SYSMENU OFF
SET STATUS BAR OFF
SET SYSFORMATS ON
SET EXCLUSIVE OFF
SET MULTILOCKS ON
_SCREEN.fontname = "Lucida Console"
_SCREEN.fontsize = 14
_SCREEN.maxheight = 720
_SCREEN.MaxWidth = 980
_SCREEN.autocenter = .T.
******** SETTINGS *******
******** DECLARATIONS *******
******** DECLARATIONS *******
******** PROGRAM BODY *******
CLEAR
DO FORM c:\deneme\forms\try1.scx
READ EVENTS
CLOSE ALL
RELEASE ALL
CLEAR EVENTS
QUIT

the followings are the codes in command1.click of "try1" form.

nNum1 = val(thisform.text1.value)
nNum2 = VAL(thisform.text2.value)

thisform.text3.value= nNum1+nNum2

When I run it within the Project Manager it is Ok.
But when built into an executable and run separately, it is invisible and can only be closed thru task manager.

What is wrong with this stuff. ?

Sorry for my understanding but could not get your email.


nguntay
 
nguntay,

Zip your project and project files and send them to me.

n o c u r e @ h c c n e t . n l (without spaces)

I'll have a look at it.

Rob.
 
skoko:
DO FORM myForm

nguntay:
Are you seting your forms ShowWindow Property to Top Level?

Regards,

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top