Go home
Go back to other tutorials

GTWVG-Tutorial


Giovanni Di Maria - calimero22@yahoo.it
since: Aug 23, 2012



Tutorial


This Tutorial:
Rev. [1] - August 23, 2012
Rev. [46] - Oct 7, 2012






A simple Window
The following example shows how to create a simple window. (by Giovanni Di Maria)



PROCEDURE Main() Wvt_SetGui( .T. ) SetMode( 25, 80 ) SetColor( "N/W" ) CLS Wvt_SetTitle( "Giovanni's Window" ) WAIT RETURN




Hello World
The following example shows how to create a simple window showing Hellp World. (by Giovanni Di Maria)



PROCEDURE Main() Wvt_SetGui( .T. ) SetMode( 25, 80 ) SetColor( "N/W" ) CLS Wvt_SetTitle( "Giovanni's Window" ) @ 05, 35 SAY "Hello World" COLOR "G/W" @ 20, 10 WAIT RETURN




Fields Get
The following example shows how to use the GET/READ fields. (by Giovanni Di Maria)



PROCEDURE Main() LOCAL cF1, cF2, cF3 LOCAL GETLIST := {} Wvt_SetGui( .T. ) SetMode( 25, 80 ) SetColor( "N/W" ) CLS Wvt_SetTitle( "Giovanni's Window" ) SetColor( "N/W,N/GR*,,,N/W*" ) cF1 = Space( 30 ) cF2 = Space( 30 ) cF3 = Space( 30 ) @ 08, 10 SAY "Enter field 1 " GET cF1 @ 10, 10 SAY "Enter field 2 " GET cF2 @ 12, 10 SAY "Enter field 3 " GET cF3 READ RETURN




Fields Get in a Raised Box
The following example shows how to use the GET/READ fields, in a Raised Box. (by Giovanni Di Maria)



FUNCTION Main() LOCAL aPaint LOCAL cF1, cF2, cF3 LOCAL GETLIST := {} Wvt_SetGui( .T. ) SetMode( 25, 80 ) SetColor( "N/W" ) CLS Wvt_SetTitle( "Giovanni's Window" ) SetColor( "N/W,N/GR*,,,N/W*" ) cF1 = Space( 30 ) cF2 = Space( 30 ) cF3 = Space( 30 ) aPaint := {} AAdd( aPaint, { NIL , { || Wvt_DrawBoxRaised( 6, 8, 14, 57 ) } , NIL } ) WvtSetPaint( aPaint ) @ 08, 10 SAY "Enter field 1 " GET cF1 @ 10, 10 SAY "Enter field 2 " GET cF2 @ 12, 10 SAY "Enter field 3 " GET cF3 READ RETURN NIL FUNCTION Wvt_Paint() WvtPaintObjects() RETURN NIL




Fields Get in a Recessed Box
The following example shows how to use the GET/READ fields, in a Recessed Box. (by Giovanni Di Maria)



FUNCTION Main() LOCAL aPaint LOCAL cF1, cF2, cF3 LOCAL GETLIST := {} Wvt_SetGui( .T. ) SetMode( 25, 80 ) SetColor( "N/W" ) CLS Wvt_SetTitle( "Giovanni's Window" ) SetColor( "N/W,N/G*,,,N/W*" ) cF1 = Space( 30 ) cF2 = Space( 30 ) cF3 = Space( 30 ) aPaint := {} AAdd( aPaint, { NIL , { || Wvt_DrawBoxRecessed( 6, 8, 14, 57 ) } , NIL } ) WvtSetPaint( aPaint ) @ 08, 10 SAY "Enter field 1 " GET cF1 @ 10, 10 SAY "Enter field 2 " GET cF2 @ 12, 10 SAY "Enter field 3 " GET cF3 READ RETURN NIL FUNCTION Wvt_Paint() WvtPaintObjects() RETURN NIL




Draw Labels
The following example shows how to draw labels on screen. (by Giovanni Di Maria)



FUNCTION Main() LOCAL aPaint Wvt_SetGui( .T. ) SetMode( 25, 80 ) SetColor( "N/W" ) CLS Wvt_SetTitle( "Giovanni's Window" ) aPaint := {} AAdd( aPaint, { NIL , { || Wvt_DrawLabel( 1, 40, "Giovanni Di Maria", 2, , rgb( 255,0,0 ), ; rgb( 255, 255, 0 ) , "Arial", 24, , , , , .T. , .T. ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawLabel( 4, 20, "Italia", 2, , rgb( 0,100,0 ), ; rgb( 180, 180, 180 ) , "Courier", 18, , , , , .T. , .T. ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawLabel( 6, 20, "Italia", 2, , rgb( 0,100,0 ), ; rgb( 180, 180, 180 ) , "Courier", 18, , , , , .F. , .F. ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawLabel( 8, 20, "Italia", 2, , rgb( 0,100,0 ), ; rgb( 180, 180, 180 ) , "Courier", 18, , , , , .T. , .F. ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawLabel( 12, 60, "Giovanni", 2, , rgb( 200,0,0 ), ; rgb( 198, 198, 198 ) , "Times New Roman", 50, , , , , .F. , .F. ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawLabel( 15, 60, "Giovanni", 2, , rgb( 200,0,0 ), ; rgb( 198, 198, 198 ) , "Monotype corsiva", 50, , , , , .F. , .F. ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawLabel( 18, 60, "Giovanni", 2, , rgb( 200,0,0 ), ; rgb( 198, 198, 198 ) , "Courier", 50, , , , , .F. , .F. ) } , NIL } ) WvtSetPaint( aPaint ) @ 23, 0 WAIT RETURN NIL FUNCTION Wvt_Paint() WvtPaintObjects() RETURN NIL FUNCTION rgb( r, g, b ) RETURN r + ( g * 256 ) + ( b * 256 * 256 )




Draw a line
The following example shows how to draw a line. (by Giovanni Di Maria)



PROCEDURE Main() LOCAL aPaint Wvt_SetGui( .T. ) SetMode( 25, 80 ) SetColor( "N/W" ) CLS aPaint := {} AAdd( aPaint, { NIL , { || Wvt_DrawLine( 06, 10, 06, 70 ) } , NIL } ) WvtSetPaint( aPaint ) @ 23, 0 WAIT RETURN FUNCTION Wvt_Paint() WvtPaintObjects() RETURN NIL




Draw an image
The following example shows how to draw a JPG photo. (by Giovanni Di Maria)



PROCEDURE Main() LOCAL aPaint Wvt_SetGui( .T. ) SetMode( 25, 80 ) SetColor( "N/W" ) CLS Wvt_SetTitle( "Giovanni's Window" ) aPaint := {} AAdd( aPaint, { NIL , { || Wvt_DrawImage( 2, 12, 10, 23, "giovanni.jpg" ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawImage( 2, 45, 18, 67, "giovanni.jpg" ) } , NIL } ) WvtSetPaint( aPaint ) @ 23, 0 WAIT RETURN FUNCTION Wvt_Paint() WvtPaintObjects() RETURN NIL




Draw ellipses
The following example shows how to draw ellipses. (by Giovanni Di Maria)



PROCEDURE Main() LOCAL aPaint Wvt_SetGui( .T. ) SetMode( 25, 80 ) SetColor( "N/W" ) CLS Wvt_SetTitle( "Giovanni's Window" ) @ 02, 35 SAY "Hello World" COLOR "G/W" aPaint := {} AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 32,255,100 ) ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawEllipse( 6, 10, 10, 18 ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 255,255,100 ) ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawEllipse( 6, 30, 10, 70 ) } , NIL } ) WvtSetPaint( aPaint ) @ 23, 10 WAIT RETURN FUNCTION rgb( r, g, b ) RETURN r + ( g * 256 ) + ( b * 256 * 256 ) FUNCTION Wvt_Paint() WvtPaintObjects() RETURN NIL




Draw rectangles
The following example shows how to draw rectangles. (by Giovanni Di Maria)



PROCEDURE Main() LOCAL aPaint Wvt_SetGui( .T. ) SetMode( 25, 80 ) SetColor( "N/W" ) CLS Wvt_SetTitle( "Giovanni's Window" ) aPaint := {} AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 255,0,0 ) ) }, NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawRectangle( 01, 07, 05, 75 ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 32,255,100 ) ) }, NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawRectangle( 07, 1 * 7, 18, 1 * 7 + 5 ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 32,255,100 ) ) }, NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawRectangle( 07, 2 * 7, 18, 2 * 7 + 5 ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 32,255,100 ) ) }, NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawRectangle( 07, 3 * 7, 18, 3 * 7 + 5 ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 32,255,100 ) ) }, NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawRectangle( 07, 4 * 7, 18, 4 * 7 + 5 ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 32,255,100 ) ) }, NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawRectangle( 07, 5 * 7, 18, 5 * 7 + 5 ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 32,255,100 ) ) }, NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawRectangle( 07, 6 * 7, 18, 6 * 7 + 5 ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 32,255,100 ) ) }, NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawRectangle( 07, 7 * 7, 18, 7 * 7 + 5 ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 32,255,100 ) ) }, NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawRectangle( 07, 8 * 7, 18, 8 * 7 + 5 ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 32,255,100 ) ) }, NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawRectangle( 07, 9 * 7, 18, 9 * 7 + 5 ) } , NIL } ) AAdd( aPaint, { NIL , { || Wvt_SetBrush( 0, rgb( 32,255,100 ) ) }, NIL } ) AAdd( aPaint, { NIL , { || Wvt_DrawRectangle( 07, 10 * 7, 18, 10 * 7 + 5 ) } , NIL } ) WvtSetPaint( aPaint ) @ 23, 10 WAIT RETURN FUNCTION rgb( r, g, b ) RETURN r + ( g * 256 ) + ( b * 256 * 256 ) FUNCTION Wvt_Paint() WvtPaintObjects() RETURN NIL




Appendix A - What users think