Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DE defined in code - autoopen won't until .init
Message
De
20/08/2006 15:42:49
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
DE defined in code - autoopen won't until .init
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01147133
Message ID:
01147133
Vues:
83
I have a form class with DeClass and DeClassLibrary set to a dataenvironment class defined in a .prg file. Like this:
Define Class Deeventbrowser as dataenvironment
Top = 196
Left = 5
Width = 668
Height = 506
DataSource = .NULL.

Add Object curEvents as cursor with ;
	Top = 20, ;
	Left = 10, ;
... (dozen more cursors here)

...
	PROCEDURE Init
	Locate		&& breaks here, because no tables are open
(more code here)

	PROCEDURE BeforeOpenTables
	Set Date ANSI
	Set Century on
	Set Mark to "-"
	Set Talk Off
	Set Nulldisplay To "---"
	Set Safety Off
	Set Exclusive Off
	Set Deleted On
	ENDPROC

	PROCEDURE Cursor3.Init
		* just a little nothing
	ENDPROC
EndDefine
This is actually an export of an old DE which used to be in a form. There, the .BefOT code ran first, then the tables opened, then form.load, then all the controls instantiated, then de.init ran, then form.init. Which was fine.

With this way of creating a form's DE, de.init runs before anything else, then the tables open, then the de.beforeopentables, form.load, controls' inits, form.init etc.

This of course breaks the code - the code in old (scx-based) DE.init ran after the tables were opened. Now .autoopentables (which is .t., checked in the debugger) doesn't mean what it used to mean. Is there any additional setting in the DE class which would make it open the tables like before, or rather run its .init after the .beforeopentables()?

Any other workaround?

update: one workaround I found was to move the code from de.init to de.afteropentables. Not too elegant, still looking for a better one.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform