Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Custom DE class
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00268063
Message ID:
00268109
Vues:
37
>Hi George,
>how would I do that?
>
Hi Pete,

Pretty simple, create a session class in a prg. Give it at least two properties (oDE, and oForm). Pass the name of the custom DE as a parameter to the Init. Allow for a second parameter (the form). I've also created an oForm_Assign event to take care of the communication between the user closing the form and the Session. Off the top of my head, the code looks something like:
DEFINE cSession AS Session
  oDE = NULL
  oForm = NULL
  
  FUNCTION Init

    LPARAMETERS pcDE, pcForm
    
    LOCAL llresult
    SET PROCEDURE TO (pcDE)
    This.oDE = CREATEOBJECT('cDataEnv')
    llresult = NOT ISNULL(This.oDe)
    IF llresult AND PCOUNT() = 2
      DO FORM (pcForm) NAME This.oForm NOSHOW
      llresult = NOT ISNULL(This.oForm)
      IF llresult
        This.oForm.DataSessionID = This.DataSessionID
        This.oForm.Show
      ENDIF
    ENDIF
    RETURN llresult
  ENDFUNC

  PROCEDURE oForm_Assign

    LPARAMETER vNewVal

    This.oForm = vNewVal
    IF ISNULL(This.oForm)
      This.Destroy
    ENDIF
    RETURN
  ENDPROC
ENDDEFINE
I should note that the actual custom DE's destroy event contains a call to CloseTables, and the Init a call to OpenTables.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform