Re: EXE file behaves different than in Design Evnironment

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: David Frankenbach (sendnospam_at_sendnospam.net)
Date: 02/05/04


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.....


Relevant Pages

  • Re: [opensuse] Cannot shut down
    ... I can't shutdown using either: ... I have to reboot from ... I'll try using "init 3" to check it out. ... If you don't get command prompt after "init 3" than press Enter it should ...
    (SuSE)
  • Re: [opensuse] Reboot via SSH
    ... I give the command to reboot, ... I learned several years ago with SuSE to use the init ... You're not even supposed to call init directly on sco, technically you're supposed to use "telinit", when for whatever reason you're not using "shutdown" like you're really supposed to. ... " If halt or reboot is called when the system is not in runlevel 0 or 6, in other words when it's running normally, shutdown will be invoked instead ...
    (SuSE)
  • Re: Form not coming up in exe
    ... Microsoft FoxPro Technical Support ... >close button to work on your app, you will need to use ON SHUTDOWN CLEAR ... >are using a top-level form, then put either a call to a shutdown proc or ... > file the program excutes but the form doesn't come up for any user input. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Reboot Vs Init 0/5/6 Vs Shutdown Vs Halt
    ... Like when and why should we use reboot ... haltbrings down the machine to the PROM immediately, ... shutdown, prints warnings to users logged in (and possibly to any NFS ... init then does things like ...
    (comp.unix.solaris)
  • Re: [opensuse] Cannot shut down
    ... The shutdown procedure is not much more than a'n init 0, the init program is the workhorse of the startup and shutdown. ... I think your real problem is a program that should be shut down first before the systemshutdown. ... Fuse is a userspace file system, I do'nt have any knowledge about this package, but userspace means that all actions are done and should be done in userspace. ...
    (SuSE)