Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Environment blow out
Message
From
28/07/2003 16:30:10
 
 
To
28/07/2003 16:10:08
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00814319
Message ID:
00814331
Views:
11
This is very interesting. I first tested it by creating a form and loading a table in the form's load event and then loading a 2nd table in the form's data environment. I ran the form and it worked fine. Both tables were available on the grids. Then I saved the form as a class to cut/paste the code to create the form in a prg and called the form with CREATEOBJECT() and lo and behold, the dataenvironment gets hosed as you mentioned. Still, issuing DO FORM testform works as expected and the dataenvironment does not get hosed. It only drops the dataenvironment if I use CREATOBJECT('testform')

Example of it hosing the dataenvironment:
SET SAFETY OFF
SELE 0
CREATE TABLE TEST (cname c(15))
SELE test
APPEND BLANK
REPLACE test.cname WITH "Smith"
SELE 0
CREATE TABLE TEST2 (cfname c(15))
SELE test
APPEND BLANK
REPLACE test2.cfname WITH "Betty"
CLOSE TABLES

oform=CREATEOBJECT('Testform')
oform.show()
READ EVENTS
RETURN

**************************************************
*-- Class:        testform (c:\profiler\progs\testform.vcx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   07/28/03 04:26:01 PM
*
DEFINE CLASS testform AS form


	Top = 0
	Left = 0
	Height = 287
	Width = 422
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT grdtest2 AS grid WITH ;
		Height = 107, ;
		Left = 72, ;
		RecordSource = "test2", ;
		RecordSourceType = 1, ;
		Top = 18, ;
		Width = 320, ;
		Name = "grdTest2"


	ADD OBJECT grid1 AS grid WITH ;
		Height = 107, ;
		Left = 72, ;
		RecordSource = "test", ;
		RecordSourceType = 1, ;
		Top = 154, ;
		Width = 320, ;
		Name = "Grid1"


	ADD OBJECT label1 AS label WITH ;
		Caption = "Test2 opened in data environment", ;
		Height = 17, ;
		Left = 12, ;
		Top = 0, ;
		Width = 216, ;
		Name = "Label1"


	ADD OBJECT label2 AS label WITH ;
		Caption = "Test opened in form load event", ;
		Height = 17, ;
		Left = 12, ;
		Top = 132, ;
		Width = 204, ;
		Name = "Label2"


	PROCEDURE Load
		SELE 0
		USE test
		GO TOP
	ENDPROC


	PROCEDURE Unload
		USE IN TEST
		CLEAR EVENTS
		ENDPROC


ENDDEFINE
*
*-- EndDefine: testform
**************************************************
I haven't noticed this to be a problem or determined a workaround because I typically load all of the tables in the form's load event. If I do decide to use the dataenvironment, I don't load tables manually in the form's load event so it has never been an issue.

Still, issuing DO FORM testform works as expected and the dataenvironment does not get hosed. It only drops the dataenvironment if I use CREATOBJECT('testform')

>Why is it that if you make a simple form and want to throw free tables in the data environment instead of coding use of them that if you use one table through code that is not in the data environment it blows the whole data environment out and you then have to dataenvironment.opentables to reload them making the program inefficient? Is there any easy way around this other than to recode the whole form so that all tables are opened with code?
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform