Re: EXE file behaves different than in Design Evnironment
From: David Frankenbach (sendnospam_at_sendnospam.net)
Date: 02/05/04
- Next message: Ee Shan: "Re: Populate combobox at runtime"
- Previous message: David Frankenbach: "Re: Treeview Imagelist Assignment ProblemOLE Dispatch Exception Code 0"
- In reply to: Subhash Chopra: "EXE file behaves different than in Design Evnironment"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 4 Feb 2004 19:55:42 -0600
Subhash,
You should use a main prg. The problem with your code below, the READ EVENTS
inside the method of the form is preventing the Activate() method from
completing its execution.
There always ends up being some environmental things setup and shutdown that
belong outside your form, so use a main.prg:
* setup here
on shutdown ShutdownApp()
do form yourform
read events
* clean up here
return
function ShutdownApp()
on shutdown
clear events
return
In your form close down, use a CLEAR EVENTS command to drop you out of the
read event loop.
Another reason for using a main is if your program has parameters passed to
it. If your form is the project "main" the parameters won't be sent to the
form.Init() because in the absence of a main.prg VFP is doing a DO FORM
behind the scenes to get the form up and running.
Welcome to VFP!
-- df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro "Subhash Chopra" <fox.vfp.forms> wrote in message news:1B2A61C6-0BDA-4B17-8D21-7F3551A7370A@microsoft.com... > I am just starting with Visual Foxpro. I have been a long time CLIPPER developer and trying to switch to VFP to convert my applications from DOS environment to Windows plateform. I started off with a very simple application with one single form containing 4 variables, 4 labels, 4 text boxes and 2 buttons. I set ShowWindow property of the Form to "2 - AS TOP LEVEL FORM". I put the following code in Init and Activate methods of the form: > > Init: > thisform.addproperty('ReadEventsFlg',.F.) > cInfile='KKKKKKKK' > cOutfile='LLLLLLLL' > dStart=ctod('01/01/2000') > dEnd=date() > > Activate: > IF !THISFORM.READEVENTSFLG > READ EVENTS > THISFORM.READEVENTSFLG=.T. > ENDIF > > In CONFIG.FPW, I put only one line SCREEN=OFF. The button named GO displays a messagebox showing values of the variables as entered by the user and CANCEL button has following code in CLICK_EVENT: > > clear events > thisform.release > > When I run the form in Design environment, everything works fine i.e. the initial values of the variables are displayed as initialized in the Init method. However, when I compile an EXE and run it under runtime, it shows all blank values. I tried moving the initialization code of the variables from Init to Activate method. Then it shows the correct value for the first text box and as I click on other boxes, those values also show up correctly. I want the form to show all four values correctly as the form is first displayed. I have playing with it for 3 days now but with no success. > > I would really appreciate help from the experts and make my entry into FOXPRO world a little easier. > > Thanks in advance.....
- Next message: Ee Shan: "Re: Populate combobox at runtime"
- Previous message: David Frankenbach: "Re: Treeview Imagelist Assignment ProblemOLE Dispatch Exception Code 0"
- In reply to: Subhash Chopra: "EXE file behaves different than in Design Evnironment"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|