Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Not possible to scan dataenvironment objects!?
Message
De
23/06/1999 19:46:25
 
 
À
18/06/1999 15:27:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00231556
Message ID:
00233271
Vues:
34
>I have forms with tables in their Dataenvironment.
>At form design time, VFP stores relative path of those cursors into cursor CursorSource. property
>
>I need to change CursorSource property because at run-time, files are at different locations.
>The only reasonable place to do it seems to be BeforeOpentables event.
>However, it is not possible to loop through cursors: dataenvironment does not have objects collection and cursor object names are changed.


Here is a way to achieve kind of what you want in the form LOAD event.
If allows you to walk down the cursor tree using AMEMBERS.
You can then experiment with setting the various values of each
cursor property.


loData = THISFORM.DataEnvironment
lnCursorCount =AMEMBERS( laCursor , loData , 2 )

IF loData.AutoOpenTables = .T.
MESSAGEBOX("Please set form to AUTOOPENTABLES = .F." )
RETURN .F.

ENDIF

***************************************************************************
*&& If there are no cursors in the class dont go any further
***************************************************************************

IF lnCursorCount = 0
lvReturn = loData.OpenTables()
&& FIRE OPENTABLES EVENT TO SYNC DATAENVIRONMENT
RETURN .T.
ENDIF



FOR lnCount = 1 TO lnCursorCount
loCursor = GETPEM ( loData , laCursor(lnCount) )
lcBuffer = loCursor.database

&& YOU NOW HAVE A POINTER TO THE CURSOR AND CAN ALTER VARIOUS SETTINGS


loCursor = .NULL.
lcDatabase = ""

ENDFOR

&& FIRE OPEN TABLES MANUALLY
lvReturn = loData.OpenTables()
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform