Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Execute code before closing form
Message
From
28/03/2007 14:08:12
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01209324
Message ID:
01209334
Views:
16
>>>>Hi all,
>>>>
>>>>Before exiting a VFP form, I need some code to execute, to update certain parameters through the command 'thisform.cmdUpdate.click'. Could anyone tell me how this is triggered a VFP form? (Which event, and how)
>>>>
>>>>Thanks in advance.
>>>>
>>>>Regards,
>>>>
>>>>Steve
>>>
>>>You may call your code from QueryUnload. It happens before you release the form (either by button or by close in the upper corner). So you may need to call your methods from this method.
>>
>>QueryUnload() did not happens if you have thisform.Release() somewhere in the form.
>
>It does.

:-)
Try:
oForm = CREATEOBJECT([form1])
oForm.Show(1)


**************************************************
*-- Form:         form1 (d:\all_zapl_4_9_0\testme.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   03/28/07 09:06:10 PM
*
DEFINE CLASS form1 AS form


    Top = 0
    Left = 0
    Height = 617
    Width = 719
    DoCreate = .T.
    Caption = "Form1"
    KeyPreview = .T.
    Name = "Form1"


    ADD OBJECT command1 AS commandbutton WITH ;
        Top = 437, ;
        Left = 368, ;
        Height = 27, ;
        Width = 280, ;
        Caption = "Clickme or Press ESC", ;
        Name = "Command1"


    PROCEDURE QueryUnload
        MessageBox([You are right Naomi. It does fire!])
    ENDPROC


    PROCEDURE KeyPress
        LPARAMETERS nKeyCode, nShiftAltCtrl
        IF nKeyCode == 27
           thisform.Release()
        ENDIF
    ENDPROC


    PROCEDURE command1.Click
        thisform.Release()
    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