Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to change dataenvironment class without losing cursors?
Message
From
23/07/2003 22:27:28
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
How to change dataenvironment class without losing cursors?
Miscellaneous
Thread ID:
00812995
Message ID:
00812995
Views:
66
An app runs from the directory of the currently selected company. During design, however, files in dataenvironment are in a different directory.

1) To get around problem I plan to change the path of files in dataenvironment in the BeforeOpenTables event. This could be done in each form's BeforeOpenTables method or better in a dataenvironment class, and then setting DEClass and DEClassLib in the form class. Unfortunately, setting DEClass loses the content of all my forms dataenvironment. Is there a way to change DEClass and yet save the work defining dataenvironments?

2) Is there a better way to solve the original problem?

------------ some time later ----------
I tried do hack form and change dataenvirionment class, but found that once that is done you can't add cursors to form, so that approach is out.

And the solution is... add the following method, which does the work, to form class and make a call to the new method from dataenvironment's beforeopentables().
LOCAL laMembers[1],lnObjects,loCursor
lnObjects = AMEMBERS(laMembers,This.DataEnvironment,2)
FOR i = 1 TO lnObjects
	loCursor = EVALUATE('This.Dataenvironment.' + laMembers[i])
	IF UPPER(loCursor.Baseclass) = 'CURSOR'
		loCursor.CursorSource = JustFName(loCursor.CursorSource)
	ENDIF
ENDFOR
Next
Reply
Map
View

Click here to load this message in the networking platform