Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- TSDWIN: Clipper 5.0 Interface Library - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

 twInitGlobal( aInGlobal )
 ----------------------------------------------------------------------------

     The TSDWIN 'meta' variables referred to throughout this manual are
     a convenient way to avoid PUBLIC and PRIVATE declarations. Most of
     us have translated old code from S'87 to Clipper 5.01. The global
     variable concept was the author's way of replacing such
     definitions. It has the added benefit of allowing the programmer
     to change the definitions on the fly. Possible uses are in the
     ability to easily create configuration files for different users
     on a network or to provide a simple framework for a colour setting
     routine. An application wide security system can be set up with
     global variables.

     The recommended method for using global variables is to refer to
     them through header file definitions using the twGetGlobal() call
     after you have initialized them with twInitGlobal() and
     twAddGlobal().

       Arguments:

     aInGlobal - 'A' an array of values to be stored for future
                     reference throughout an application.

       Return:

     Nothing

       Example:

     // place this in a header file
     #define NTEXT   IF( ISCOLOR(), "b/bg,gr+/r,,gr+/bg,n/w", ;
                       "w+/n, n/w,, w+/n, w/n" ) // A Box Text Color
     #define NFRAME  IF( ISCOLOR(), { "gr+/bg", "w/bg" }, ;
                       { "w+/n", "w/n" } )       // A Box Frame Color
     #define ATEXT   IF(ISCOLOR(), ;
                  "w/b,gr+/r,,gr+/b,w+/b,rb+/b,bg+/b,b/b,g+/b,n/w", ;
                  "w+/n,n/w,,w/n,w+/n,n/w,w+/n,w/n,n/w,n/w" )
                   // Normal Text Color
     #define AFRAME  IF( ISCOLOR(), { "bg+/b", "bg/b" }, ;
                       { "w+/n", "w/n" } )       // Normal Frame Color
     #define BTEXT   IF( ISCOLOR(), "w+/gr, gr+/b,, gr+/rb, n/w", ;
                       "w+/n, n/w,, n/w, w/n" )  // B Box Text Color
     #define BFRAME  IF( ISCOLOR(), { "bg+/gr", "bg/gr" }, ;
                       { "w+/n", "w/n" } )       // B Box Frame Color
     #define CTEXT   IF( ISCOLOR(), "n/bg, gr+/r,, w+/bg, n/w", ;
                       "w+/n, n/w,, n/w, w/n" )  // C Box Text Color
     #define CFRAME  IF( ISCOLOR(), { "gr+/bg", "w/bg" }, ;
                       { "w+/n", "w/n" } )       // C Box Frame Coloror
     #define CTITLEN IF( ISCOLOR(), "n/w", "n/w" )
     #define CTITLEA IF( ISCOLOR(), "n/w", "n/w" )
     #define CTITLEB IF( ISCOLOR(), "n/w", "n/w" )
     #define CTITLEC IF( ISCOLOR(), "n/w", "n/w" )
     #define CLKCLR  IF( ISCOLOR(), "gr+/b", "w+/n" )
     #define EFRAME   4
     #define ESHADOW  3
     #define EBLINK  .F.
     #define EEXPL   .F.
     #define EDIAL   .F.
     #define EDELETE .F.
     #define EAPPTS  .F.
     #define ECOUNTRY 1
     #define ECONFIG .F.

     //  put this in your program
     twInitGlobal({ NTEXT, NFRAME, ATEXT, AFRAME, BTEXT, BFRAME,;
                    CTEXT, CFRAME, CTITLEN, CTITLEA, CTITLEB, ;
                    CTITLEC, EFRAME, ESHADOW, EBLINK, EEXPL, ;
                    EDIAL, EDELETE, EAPPTS, ECOUNTRY, ECONFIG } )

     // this is also in the header file
     #define NCOLOR          twGetGlobal( 01 )
     #define NCOLORF         twGetGlobal( 02 )
     #define ACOLOR          twGetGlobal( 03 )
     #define ACOLORF         twGetGlobal( 04 )
     #define BCOLOR          twGetGlobal( 05 )
     #define BCOLORF         twGetGlobal( 06 )
     #define CCOLOR          twGetGlobal( 07 )
     #define CCOLORF         twGetGlobal( 08 )
     #define NTITLECLR       twGetGlobal( 09 )
     #define ATITLECLR       twGetGlobal( 10 )
     #define BTITLECLR       twGetGlobal( 11 )
     #define CTITLECLR       twGetGlobal( 12 )
     #define SYSFRAME        twGetGlobal( 13 )
     #define SYSSHADOW       twGetGlobal( 14 )
     #define SYSBLINK        twGetGlobal( 15 )
     #define SYSEXPLODE      twGetGlobal( 16 )
     #define SYSDIAL         twGetGlobal( 17 )
     #define SYSDELETE       twGetGlobal( 18 )
     #define SYSAPPTS        twGetGlobal( 19 )
     #define SYSCOUNTRY      twGetGlobal( 20 )
     #define SYSCONFIG       twGetGlobal( 21 )

     Therefore, if you want to always ensure a certain kind of  window
     looks the same you might open it with:

     twOpen( 2, 2, 10, 76, NCOLOR, SYSSHADOW, SYSFRAME,, NCOLORF )

     Or go even further and define window functions:

     .............
     FUNCTION NormalWindow( nTop, nLeft, nBottom, nRight )
     LOCAL nHandle

     DEFAULT nTop TO 0,;
             nLeft TO 0,;
             nBottom TO MAXROW(),;
             nRight TO MAXCOL()

     nHandle := twOpen( 2, 2, 10, 76, NCOLOR, SYSSHADOW, ;
                        SYSFRAME,, NCOLORF )
     RETURN nHandle
     .............

     Then open normal windows with, for example:

     NormalWindow( 2, 2, 10, 76 ) //if you don't need the handle.

     TSDWIN looks after the rest.

See Also: twDelGlobal() twSetGlobal() twAddGlobal() twGetGlobal()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson