Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Switching DataSession's
Message
De
13/12/2004 14:06:19
 
 
À
13/12/2004 13:35:49
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00968641
Message ID:
00968857
Vues:
8
ok, now i am realy messed up <s>

i tryed you test code, and sure enough it sets the ds correctly. so, this triggert me to write a test code displaying a more accureate structure of my app. here it is (double click on the label):
CLEAR
oToolBox = NEWOBJECT("ToolBox")

* *** this might have been called by other functions previously
oToolBox.oGlobalStr.ShowDS()

oForm = NEWOBJECT("MyForm")
oForm.SHOW()
READ EVENTS

RELEASE ;
	oToolBox, ;
	oForm
RETURN


DEFINE CLASS MyForm AS FORM
	DATASESSION = 2
	LEFT = 200

	ADD OBJECT TestLabel1 AS TestLabel
	
	PROCEDURE ACTIVATE
		* *** some of the objects on the form might be calling this
                oToolBox.oGlobalStr.ShowDS()
	ENDPROC
	
	PROCEDURE DESTROY
		CLEAR EVENTS
	ENDPROC
ENDDEFINE

define class TestLabel as label
	Caption = "Gunni Test"
	
	procedure DblClick
		oToolBox.oGlobalStr.ShowDS()
		wait wind 'finished dbl click' nowait
	endproc
enddefine

DEFINE CLASS ToolBox AS CUSTOM
	oGlobalStr = .NULL.

	PROCEDURE oGlobalStr_access
		IF UPPER(PROGRAM(PROGRAM(-1)-1)) <> "TOOLBOX.DESTROY"
			IF TYPE("THIS.oGlobalStr") <> "O" .OR. ISNULL(THIS.oGlobalStr)
				THIS.oGlobalStr = NEWOBJECT("GlobalStr")
			ENDIF
			*THIS.AssignCaller(THIS.oglobalstr)
		ENDIF

		RETURN THIS.oGlobalStr
	ENDPROC
ENDDEFINE

DEFINE CLASS GlobalStr AS CUSTOM

	PROCEDURE ShowDS
		IF TYPE("_screen.ActiveForm") = "O" AND !ISNULL(_SCREEN.ACTIVEFORM)
			IF _SCREEN.ACTIVEFORM.DATASESSION = 2 && Private
				_SCREEN.CLS
				SET DATASESSION TO _SCREEN.DATASESSIONID
				_SCREEN.PRINT('Screen: '+TRANS(SET("DataSession"))+CHR(13))
				SET DATASESSION TO _SCREEN.ACTIVEFORM.DATASESSIONID
				_SCREEN.PRINT('ActiveForm: '+TRANS(SET("DataSession"))+CHR(13))
				SET DATASESSION TO
				_SCREEN.PRINT('Current: '+TRANS(SET("DataSession"))+CHR(13))
			ENDIF
		ENDIF
	ENDPROC
ENDDEFINE
problem is - this is also setting the ds correctly. so now i am at a loss as to why this works, but in my app it does not. i am gonna check around a few things and see what the difference is.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform