>
> ***********************************************************************
> * Program....: SetPresEnv.prg
> * Author.....: Andy Kramek
> * Date.......: 02 August 2001
> * Notice.....: Copyright (c) 2001 Tightline Computers Ltd, All Rights Reserved.
> * Compiler...: Visual FoxPro 07.00.0000.9262 for Windows
> * Purpose....: Environment Setup Program
> ***********************************************************************
>
> RELEASE glCopySQL
> PUBLIC glCopySQL
> glCopySQL = .T.
>
>
> + using that PUBL VAR Value somethere inside a HIDDEN CLASS ... great encapsulation there Pal!!
What makes you think this is a class definition, let alone a hidden class? This is taken out of context from an environmental setup program for a conference session given at the San Diego DevCon in 2001. This variable is used to override normal behavior and dump SQL generated in the course of demonstrations to the clipboard for showing attendees. It is merely the configuration program run to set paths, and other environmental items for a demonstration!
If you must post my code, then post ALL of it not just selected parts!
***********************************************************************
* Program....: SetPresEnv.prg
* Author.....: Andy Kramek
* Date.......: 02 August 2001
* Notice.....: Copyright (c) 2001 Tightline Computers Ltd, All Rights Reserved.
* Compiler...: Visual FoxPro 07.00.0000.9262 for Windows
* Purpose....: Environment Setup Program
***********************************************************************
CLOSE DATABASES ALL
CLEAR
LOCAL lcPath
***************************************************
*** Start with the Path
***************************************************
*** This is Dev Mode - Full Path required
lcPath = (HOME() + ";" ) + (FULLPATH( CURDIR() ) + ";METADATA;DATA")
SET PATH TO (lcPath)
*** We can also force Asserts on in this case
SET ASSERTS ON
*** And set the variable which makes data classes copy SQL to clipboard
RELEASE glCopySQL
PUBLIC glCopySQL
glCopySQL = .T.
***************************************************
*** Now we should be able to open the class libraries without errors
***************************************************
SET CLASSLIB TO rootclass, genforms, basectrl, presclass ADDITIVE
***************************************************
*** And the Procedure files
***************************************************
SET PROCEDURE TO dataclass, dsetbase ADDITIVE
***************************************************
*** We need to add the Data Manager and Connect to SQL Server
*** So make sure we have the _Screen property
***************************************************
IF NOT PEMSTATUS( _Screen, 'oDM', 5 )
_Screen.AddProperty( 'oDM', NULL )
ENDIF
***************************************************
*** Add the Data Manager and Connect. Check for success
***************************************************
_Screen.oDM = CREATEOBJECT( 'xDatMgr', 'vfpdemo' )
IF VARTYPE( _Screen.oDM ) = "O"
*** We have the Data Manager, but did it connect?
lnCon = _Screen.oDm.GetHandle( 'VFP' )
IF lnCon < 0
MESSAGEBOX( 'Cannot Connect using VFPDemo', 16, 'Setup Error' )
RETURN
ENDIF
*** OK, now add the SQL Connection
_Screen.oDM.AddConnection( 'sqldemo' )
lnCon = _Screen.oDm.GetHandle( 'SQL' )
IF lnCon < 0
MESSAGEBOX( 'Cannot Connect using SQLDemo', 16, 'Setup Error' )
RETURN
ENDIF
ELSE
MESSAGEBOX( 'Cannot create the Data Manager', 16, 'Fatal Setup Error' )
RETURN
ENDIF
***************************************************
*** Now run the Demo Manager
***************************************************
SET STATUS BAR OFF
DO FORM DemoMgr
This is only used so that I can demonstrate something easily in a Conference session. It is certainly not application or "production" code.
Regards
Andy Kramek
Microsoft MVP (Visual FoxPro)
Tightline Computers Inc, Akron Ohio, USA