Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form and Datasession problem
Message
From
31/03/2004 13:14:51
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
31/03/2004 11:40:19
Mike Sue-Ping
Cambridge, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00891069
Message ID:
00891235
Views:
30
This message has been marked as the solution to the initial question of the thread.
Hi Mike

I did a test too. I don't like to leave a problem unresolved. Switching to class-based forms just to get around the problem is leaving the problem unresolved. ;)

My test was to run DO JUNK from the command window.
JUNK.PRG
ACTIVATE SCREEN
CLEAR
SET TALK ON
SET NOTIFY ON
SET STATUS BAR OFF
PUBLIC oMyApp
SET CLASSLIB TO myapp.VCX
oMyApp = CREATEOBJECT("myapp")

DO FORM junk1
READ events
CLEAR ALL
Here's the form...
**************************************************
*-- Form:         form1 (junk1.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*
DEFINE CLASS form1 AS form


	DataSession = 2
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 84, ;
		Left = 180, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Color", ;
		Name = "Command1"


	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 84, ;
		Left = 48, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Quit", ;
		Name = "Command2"


	PROCEDURE Init
		WAIT WINDOW "Form.Init"
		FOR X = 1 TO 100
		  A=M.X
		ENDFOR
		RETURN DODEFAULT()
	ENDPROC


	PROCEDURE command1.Init
		WAIT WINDOW "Color button init"
		FOR i = 1 TO 1000
		NEXT I
		RETURN DODEFAULT()
	ENDPROC


	PROCEDURE command1.Click
		WAIT WINDOW SET("TALK")
		oMyApp.SetFormColor(THISFORM)

		WAIT WINDOW SET("TALK")
		FOR I = 1 TO 100
		  A=m.I
		NEXT I
	ENDPROC


	PROCEDURE command2.Click
		CLEAR EVENTS
		THISFORM.Release()
		RETURN .T.
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Here's my app object.
**************************************************
*-- Class:        myapp (myapp.vcx)
*-- ParentClass:  custom
*-- BaseClass:    custom
*
DEFINE CLASS myapp AS custom


	Name = "myapp"


	PROCEDURE setformcolor
		LPARAMETERS m.toForm
		m.toForm.BackColor = RGB(255,255,255)
	ENDPROC


ENDDEFINE
*
*-- EndDefine: myapp
**************************************************
I added code like this to the form.dataenvironment OpenTables, BeforeOpenTables, and Init methods.
A=PROGRAM() + " Before SET TALK OFF" && SHOULD ECHO
SET TALK OFF
B=PROGRAM() + " After SET TALK OFF" && SHOULD NOT ECHO
What you'll see is the earliest place to SET TALK OFF is in the data environment's OpenTables method. Put SET TALK OFF there. If it comes back, you'll have to start tracing. ;)

HTH!


>Just for "fun" I did a test. I saved my form as a class then instead of DO FORM..., I did myform = CREATEOBJECT("myformclass"). BAM! It works without any information echoing/talking on the VFP SCREEN.
>
>I had to put code into the form class Load() event to open my views since there is no form dataenvironment in the form class.
>
>Do you have any ideas as to why it works this way and not the other?
>
>Thanks for all the input.
>
>Regards,
>
>Mike
>
>>Is SET TALK OFF the first line in the form.load?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform