Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does quit (in a form) fire unload?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
SAMBA Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01059261
Message ID:
01059297
Views:
7
>>>I have an foxpro exe that runs from a shortcut normally. If it is run with a certain parameter from the command line (via "Scheduled Tasks") it should start up, do some processing in the form.init then exit. I have found that you cannot call thisform.release in the init but quit works. If quit is in the form.init will it fire the form.unload method?
>>Not sure, becuase never test it, but after you do processing in init event of the form you alway scan RETURN .f. to release the form.
>
>RETURN .f. leaves my app runnning. I have to go to the Foxpro Program menu and select "Cancel". In my form.unload I have CLEAR EVENTS so I'm not sure what is happening.


Joe,
I now realise what happens. READ EVENTS is AFTER return .f. of the form init.
oForm = CREATEOBJECT("Form1")
READ EVENTS && That line is AFTER return .f. of the form and Unload Event of the form. So CLEEAR EVENTS has no effects

**************************************************
*-- Form:         form1 (d:\works\traff\tte.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   10/14/05 10:41:01 PM
*
DEFINE CLASS form1 AS form


    DoCreate = .T.
    Caption = "Form1"
    Name = "Form1"


    PROCEDURE Init
        RETURN .f.
    ENDPROC


    PROCEDURE Unload
        WAIT WINDOW "Unload" NOWAIT
        CLEAR EVENTS
    ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Chane it to:
oFOrm = CREATEOBJECT("Form1")


**************************************************
*-- Form:         form1 (d:\works\traff\tte.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   10/14/05 10:41:01 PM
*
DEFINE CLASS form1 AS form


    DoCreate = .T.
    Caption = "Form1"
    Name = "Form1"


    PROCEDURE Init
        ***** 
        Do whaever you want to to
        IF some_condition
           RETURN .f.
        ENDIF
        READ EVENTS        
    ENDPROC


    PROCEDURE Unload
        WAIT WINDOW "Unload" NOWAIT
        CLEAR EVENTS
    ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform