|
Home > Archive > FoxPro Setup > October 2005 > Simple Compile Question
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Simple Compile Question
|
|
| Dthmtlgod 2005-10-27, 8:34 am |
| Getting back into VFP. Using Version 8.0
I am trying create a very simple application (EXE), just opening up a simple
form, no controls on the forms.
One line of code in my PRG
DO FORM Main
I compile the PRG and create my EXE. I run the EXE and the screen flashes,
but no form shows. What am I doing wrong?
Thanks in advance
| |
| Fred Taylor 2005-10-27, 8:34 am |
| You need a READ EVENTS to stop the form in a wait state (to stay on the
screen). You'd then also need a CLEAR EVENTS to exit the program.
* your.prg
DO FORM Main
READ EVENTS
You'd need the CLEAR EVENTS in the click code of a button, or in the Destroy
method of the form, otherwise you'd be hung at the READ EVENTS.
--
Fred
Microsoft Visual FoxPro MVP
"Dthmtlgod" <dthmtlgod@hotmail.com> wrote in message
news:%23GvT%23c30FHA
.2792@tk2msftngp13.phx.gbl...
> Getting back into VFP. Using Version 8.0
> I am trying create a very simple application (EXE), just opening up a
> simple
> form, no controls on the forms.
>
> One line of code in my PRG
> DO FORM Main
>
> I compile the PRG and create my EXE. I run the EXE and the screen
> flashes,
> but no form shows. What am I doing wrong?
>
> Thanks in advance
>
>
| |
| Dthmtlgod 2005-10-27, 8:34 am |
| Thank you Fred
"Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
news:ONB8tC60FHA.4032@TK2MSFTNGP15.phx.gbl...
> You need a READ EVENTS to stop the form in a wait state (to stay on the
> screen). You'd then also need a CLEAR EVENTS to exit the program.
>
> * your.prg
> DO FORM Main
> READ EVENTS
>
> You'd need the CLEAR EVENTS in the click code of a button, or in the
Destroy
> method of the form, otherwise you'd be hung at the READ EVENTS.
>
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "Dthmtlgod" <dthmtlgod@hotmail.com> wrote in message
> news:%23GvT%23c30FHA
.2792@tk2msftngp13.phx.gbl...
>
>
| |
| Dthmtlgod 2005-10-27, 8:34 am |
| Gave it a try and it is still not working
Here are the only two lines of code on my PRG
DO FORM Main
READ EVENTS
Here are the only two lines of code in my FRM. It is a simple command
button (onclick event)
MESSAGEBOX("Test",1,"Test")
CLEAR EVENTS
The forms flashes but goes away.
"Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
news:ONB8tC60FHA.4032@TK2MSFTNGP15.phx.gbl...
> You need a READ EVENTS to stop the form in a wait state (to stay on the
> screen). You'd then also need a CLEAR EVENTS to exit the program.
>
> * your.prg
> DO FORM Main
> READ EVENTS
>
> You'd need the CLEAR EVENTS in the click code of a button, or in the
Destroy
> method of the form, otherwise you'd be hung at the READ EVENTS.
>
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "Dthmtlgod" <dthmtlgod@hotmail.com> wrote in message
> news:%23GvT%23c30FHA
.2792@tk2msftngp13.phx.gbl...
>
>
| |
| Dennis Longfellow 2005-10-27, 8:34 am |
| > Gave it a try and it is still not working
>
> Here are the only two lines of code on my PRG
>
> DO FORM Main
> READ EVENTS
>
> Here are the only two lines of code in my FRM. It is a simple command
> button (onclick event)
>
> MESSAGEBOX("Test",1,"Test")
> CLEAR EVENTS
>
> The forms flashes but goes away.
>
Hi,
Actually, it is working. The READ EVENTS command starts the event loop
which means that your program is waiting for the user to do something like
click on a command button. In this case, your command button's click event
included the CLEAR EVENTS command which terminates the event loop and tells
the program to go to its next command. Since you do not have any more
commands, the program terminates.
What you need to do is to remove the CLEAR EVENTS command from the command
button's click event then add another command button to the form and put the
follow code into its click event:
THISFORM.Release
In the form's Destroy (or Unload) event, put the following code:
CLEAR EVENTS
Hope that helps.
Sincerely,
Dennis Longfellow
| |
| DeCiacco 2005-10-27, 8:34 am |
| Ok...if you want to create an Single Document Application or one with only Top Level
Forms, and not see the Screen, then you can do the following:
1. Create a new folder where your new project is going to be.
2. Create a new project and save it in your new folder.
2. Under programs add a main.prg. (Should be [Set Main] after right clicking on file)
3. Add these two lines of code:
DO FORM Main
READ EVENTS
4. Add a new form to your project, main.scx.
5. Change the following properties on your main.scx form:
AutoCenter = .T.
Form comes up centered on desktop (Optional)
BorderStyle = 1 - FixedSingle
Can't be resized (Optional)
Caption = Anything you want
Will show in form title bar (Optional)
Name = frmMain
I like to give all my forms a name (Optional)
ShowWindow = 2 - As Top Level Form
Very important, allows it to show when the FoxPro screen is not loaded. In an
SDI app all forms need to be Top Level unless you create your own MDI (Multiple
Document Interface) form, but that's a different topic. Also, if your form is a
top level form it can't be Modal.
6. Place a command button on your form
7. Change the following properties on your button:
Name = cmdClose
Caption = \<Close
The "\<" will underline the letter immediately after it. In this case the letter
C. This allows shortcut keys.
8. In the Click event of your command button place the following two lines of code:
THISFORM.RELEASE()
CLEAR EVENTS
9. The last little piece you need is the Config.fpw file. Open notepad and add
these two lines of code:
screen=off
This will keep the foxpro screen from showing. Experiment with this on and off
and read up on the config.fpw file and its settings for a better understanding.
resource=off
These keeps your app from creating resource files when it runs. Read up on this
more if you'd like more info.
Save your text file as "Config.fpw" and place it in the same folder as your
project, which is going to later have your compiled exe. This file needs to be
either in the same folder as your exe, or you can add it to your project under text
files, which is what I recommend.
10. Build your executable and save it in your project folder. When you run it all you
should see is the main form.
There are a lot of other things you will need to do in your main.prg file like set
your default and path variables so your application can find your programs, forms,
and other components. You may also look into the On Shutdown event to tell your app
what to do on shutdown. Also, many people use an Application object to do many of
these tasks, but that gets into Object Oriented stuff and it may be a ways down the road.
I tried to attach a zip file with a sample, but I don't know if it worked. If it did
not, you can download it here:
http://www.deciacco.com/foxpro/simpletest.zip
I hope this helps.
Dthmtlgod wrote:
> Gave it a try and it is still not working
>
> Here are the only two lines of code on my PRG
>
> DO FORM Main
> READ EVENTS
>
> Here are the only two lines of code in my FRM. It is a simple command
> button (onclick event)
>
> MESSAGEBOX("Test",1,"Test")
> CLEAR EVENTS
>
> The forms flashes but goes away.
>
>
>
> "Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
> news:ONB8tC60FHA.4032@TK2MSFTNGP15.phx.gbl...
>
>
> Destroy
>
>
>
| |
| Dthmtlgod 2005-10-27, 8:34 am |
| Thanks so much
"DeCiacco" < eugenioNOSPAM@NOSPAM
iatmgu.comNOSPAM> wrote in message
news:eyMQHc$0FHA.4004@TK2MSFTNGP10.phx.gbl...
> Ok...if you want to create an Single Document Application or one with only
Top Level
> Forms, and not see the Screen, then you can do the following:
>
> 1. Create a new folder where your new project is going to be.
> 2. Create a new project and save it in your new folder.
> 2. Under programs add a main.prg. (Should be [Set Main] after right
clicking on file)
> 3. Add these two lines of code:
>
> DO FORM Main
> READ EVENTS
>
> 4. Add a new form to your project, main.scx.
> 5. Change the following properties on your main.scx form:
>
> AutoCenter = .T.
> Form comes up centered on desktop (Optional)
>
> BorderStyle = 1 - FixedSingle
> Can't be resized (Optional)
>
> Caption = Anything you want
> Will show in form title bar (Optional)
>
> Name = frmMain
> I like to give all my forms a name (Optional)
>
> ShowWindow = 2 - As Top Level Form
> Very important, allows it to show when the FoxPro screen is not loaded. In
an
> SDI app all forms need to be Top Level unless you create your own MDI
(Multiple
> Document Interface) form, but that's a different topic. Also, if your form
is a
> top level form it can't be Modal.
>
> 6. Place a command button on your form
> 7. Change the following properties on your button:
>
> Name = cmdClose
>
> Caption = \<Close
> The "\<" will underline the letter immediately after it. In this case the
letter
> C. This allows shortcut keys.
>
> 8. In the Click event of your command button place the following two lines
of code:
>
> THISFORM.RELEASE()
> CLEAR EVENTS
>
> 9. The last little piece you need is the Config.fpw file. Open notepad and
add
> these two lines of code:
>
> screen=off
> This will keep the foxpro screen from showing. Experiment with this on and
off
> and read up on the config.fpw file and its settings for a better
understanding.
>
> resource=off
> These keeps your app from creating resource files when it runs. Read up on
this
> more if you'd like more info.
>
> Save your text file as "Config.fpw" and place it in the same folder as
your
> project, which is going to later have your compiled exe. This file needs
to be
> either in the same folder as your exe, or you can add it to your project
under text
> files, which is what I recommend.
>
> 10. Build your executable and save it in your project folder. When you run
it all you
> should see is the main form.
>
> There are a lot of other things you will need to do in your main.prg file
like set
> your default and path variables so your application can find your
programs, forms,
> and other components. You may also look into the On Shutdown event to tell
your app
> what to do on shutdown. Also, many people use an Application object to do
many of
> these tasks, but that gets into Object Oriented stuff and it may be a ways
down the road.
>
> I tried to attach a zip file with a sample, but I don't know if it worked.
If it did
> not, you can download it here:
>
> http://www.deciacco.com/foxpro/simpletest.zip
>
> I hope this helps.
>
> Dthmtlgod wrote:
>
|
|
|
|
|