Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Moving code from de.beforeopentables to form.load
Message
De
10/02/1999 16:53:09
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00186197
Message ID:
00186238
Vues:
28
>I am moving the code that points my dataenvironment's cursors to the proper directory from the dataenvironments beforeopentables event to the forms (actually the class's) load event. The code is
>
>thisform.SetAll("Database",gcAppPath+"\database\patdb.dbc","Cursor")
>
>I am getting the error "property setting will not take effect until the data environment is loaded". I assume is is because the cursors are already open before the load event. How do I delay the opening opening of the cursors and then open them manually?

Hi Evan,
Here's some code from my data form base class load event....
* if there is a dataenvironment...
IF TYPE(".Dataenvironment.Name") = "C"
	LOCAL oDE
	oDE= THIS.Dataenvironment
	IF ! oDE.AutoOpenTables
		SetCursorPaths(m.oDE)
		oDE.OpenTables()
	ENDIF	
ENDIF		&& Dataenvironment

*** Here's the essential code for SetCursorPaths() 
* SETCURSORPATHS()
* Resets the paths in a DE to that spec'd
* designed to be called from BeforeOpenTables() of DE or Load event of data form
lparameter oDe
local nn, oC, cName
local array a_O[1]

nn= amembers(a_O, m.oDe, 2)
for each cName in a_O
	oC= evaluate("m.Ode." + m.cName)
	if oC.BaseClass = "Cursor"
		if empty(oC.Database)
			* If a free table adjust the cursorsource
			oC.CursorSource= "your file source"
		else
			* otherwise adjust the database source
			oC.Database= "your database source"
		endif
	endif
endfor
In reality I store the table locations in a table and use it to set the sources.
HTH
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform