Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where should I put READ EVENTS in main?
Message
From
11/10/2001 23:47:51
Peter Brama
West Pointe Enterprises
Detroit, Michigan, United States
 
 
To
11/10/2001 04:35:32
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00566462
Message ID:
00567401
Views:
12
Yes, now with this code sample, it makes even more sense... I have some coding to fix... all the apps I have written thus far, are missing the close and release lines. As a C++ programmer, I knew I needed them, just good programming practice, but I could never figure out in VFP where to put them.


>Peter
>
>Here's how I normally/simply use READ EVENTS:
>
>
>*Env Settings
>SET blah blah...
>
>*Run Form
>DO FORM MainForm  && This is NOT a MODAL FORM
>
>*Read Events will stop this program from continuing, and will continue
>*when the above Form issues CLEAR EVENTS
>READ EVENTS
>
>*Continue this program now due to a CLEAR EVENTS being issued
>CLOSE ALL
>CLEAR ALL
>RELEASE ALL
>
>
>Does that make sense ?
>
>Kev
>
>>Whoops, forgot to put this sample code in...
>>
>>
>>set talk off
>>set deleted on
>>set bell off
>>set sysmenu off
>>set multilocks on
>>set exclusive off
>>on shutdown quit
>>
>>clear
>>_screen.windowstate=2
>>_screen.caption="My App v1.0, Copyright 2001 West Pointe Enterprises"
>>_screen.backcolor=rgb(58,110,165)
>>_screen.minbutton=.F.
>>_screen.maxbutton=.F.
>>
>>use mysystfile
>>if empty(mysystfile.fThisField) then
>>  if reccount()=0 then
>>    append blank
>>  endif
>>  do form mysystform to vAbort
>>  if vAbort=.T. then
>>    clear events
>>    quit
>>  endif
>>endif
>>
>>do form myinitialform
>>read events
>>
>>
>>
>>The MYINITIALFORM fires even when vAbort=.T.
>>
>>Pete
>>
>>
>>>Peter
>>>
>>>READ EVENTS will effectively wait until CLEAR EVENTS is issued. So what you have done is correct. In the UNLOAD Event on the form, issue CLEAR EVENTS. Any code AFTER the READ EVENTS will then execute.
>>>
>>>Kev
>>>>I have always had a main program that consists of:
>>>>
>>>>set talk off
>>>>set deleted on
>>>>set bell off
>>>>set sysmenu off
>>>>set multilocks on
>>>>set exclusive off
>>>>on shutdown quit
>>>>
>>>>clear
>>>>_screen.windowstate=2
>>>>_screen.caption="My App, Copyright 2001 West Pointe Enterprises"
>>>>_screen.backcolor=rgb(58,110,165)
>>>>_screen.minbutton=.F.
>>>>_screen.maxbutton=.F.
>>>>
>>>>do form mbappform
>>>>read events
>>>>
>>>>
>>>>Should the READ EVENTS be the last item? I guess I don't understand fully what READ EVENTS does. I know it starts "event processing" which I believe is the "processing" of commands, buttons, code, etc.
>>>>
>>>>With it AFTER the form I want run... wouldn't that technically not run the code on a form because the READ EVENTS fires AFTER the form? I know this works, but I don't understand why.
>>>>
>>>>
>>>>Is this NORMALLY what is in the main program for an app? What about if I want to do some file manipulation PRIOR to the MBAPPFORM running... I shouldn't put that in here only in the FORM such as in the LOAD or INIT section?
>>>>
>>>>Thanks ahead of time for all the great help here!!
Peter Brama
West Pointe Enterprises

VFP is getting easier but STILL alot to learn!!
Previous
Reply
Map
View

Click here to load this message in the networking platform