Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not possible to scan dataenvironment objects!?
Message
From
23/06/1999 19:46:25
 
 
To
18/06/1999 15:27:58
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00231556
Message ID:
00233271
Views:
32
>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()
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform