More elements to play...
/*
* $Id: wvtext.prg 8723 2008-06-13 17:26:48Z vszakats $ */
//----------------------------------------------------------------------
//
//----------------------------------------------------------------------
//
//----------------------------------------------------------------------
//
//
// [x]Harbour Extended Features Deno
// .
// Pritpal Bedi <[EMAIL PROTECTED]>
//
//----------------------------------------------------------------------
//
//----------------------------------------------------------------------
//
//----------------------------------------------------------------------
//
#include 'hbgtinfo.ch'
#include 'inkey.ch'
#define RGB(r,g,b) ( r + ( g * 256 ) + ( b * 256 * 256 ) )
//----------------------------------------------------------------------
//
FUNCTION Main()
Local nKey, lMark, lResize, lClose
Local nHeight := 20
Local nWidth := Int( nHeight/2 )
Local cFont
//cFont := 'Courier New' // Harbour default
//cFont := 'Times New Roman'
//cFont := 'Lucida Console'
Hb_GtInfo( HB_GTI_FONTNAME , cFont )
Hb_GtInfo( HB_GTI_FONTWIDTH, nWidth )
Hb_GtInfo( HB_GTI_FONTSIZE , nHeight )
SetCursor( 0 )
SetColor( 'n/w' )
HB_GtInfo( HB_GTI_NOTIFIERBLOCK, {|nEvent, ...| MyNotifier( nEvent,
... ) } )
DispScreen()
DO WHILE .T.
nKey := Inkey()
if nKey == K_ESC
exit
endif
DO CASE
CASE nKey == K_ENTER
Alert( '<Enter> Pressed' )
CASE nKey == K_F2
lMark := Hb_GtInfo( HB_GTI_SELECTCOPY )
Hb_GtInfo( HB_GTI_SELECTCOPY, !lMark )
CASE nKey == K_F3
lResize := Hb_GtInfo( HB_GTI_RESIZABLE )
Hb_GtInfo( HB_GTI_RESIZABLE, !lResize )
CASE nKey == K_F4
lClose := Hb_GtInfo( HB_GTI_CLOSABLE )
hb_GtInfo( HB_GTI_CLOSABLE, !lClose )
CASE nKey == K_F5
SetPalette( 1 )
CASE nKey == K_F6
SetPalette( 0 )
CASE nKey == K_F7
SetPaletteIndex()
CASE nKey == K_F8
Alert( "Menu text changed. Was: " + hb_GtInfo(
HB_GTI_SELECTCOPY,
DToS(Date()) + " " + Time() ) )
CASE nKey == K_F9
NewWindow()
ENDCASE
ENDDO
RETURN NIL
//----------------------------------------------------------------------
//
STATIC FUNCTION MyNotifier( nEvent, ... )
DO CASE
CASE nEvent == HB_GTE_SETFOCUS
DispScreen()
DispOutAt( maxrow(), 33, "We got focus", 'B/G*' )
CASE nEvent == HB_GTE_CLOSE
DispScreen()
if Alert( 'Close Application', {'Yes','No' } ) == 2
Return ( 1 )
endif
ENDCASE
RETURN 0
//----------------------------------------------------------------------
//
STATIC FUNCTION DispScreen()
Local nRow := 12, nCol := 28
Local cColor := 'N/W'
Local nMaxCol := MaxCol()+1
DispBegin()
CLS
DispOutAt( 0, 0,padc( 'Harbour GT - New Features', maxcol()+1 ),
'N/GR*'
)
// Contributed by Massimo Belgrano
DispOutAt( 2, 0, padc( "______ __ ______________________
",nMaxCol ), 'W+/W' )
DispOutAt( 3, 0, padc( "___ / / /_____ ___________ /___________
_________ __ ____/____/",nMaxCol ), 'W+/W' )
DispOutAt( 4, 0, padc( "__ /_/ /_ __ `/_ ___/_ __ \ __ \ / / /_
___/ _ / __ __/ ",nMaxCol ), 'W+/W' )
DispOutAt( 5, 0, padc( "_ __ / / /_/ /_ / _ /_/ / /_/ / /_/ /_
/
/ /_/ / _ / ",nMaxCol ), 'W+/W' )
DispOutAt( 6, 0, padc( "/_/ /_/ \__,_/ /_/ /_.___/\____/\__,_/
/_/
\____/ /_/ ",nMaxCol ), 'W+/W' )
DispOutAt( ++nRow, nCol, '< F2 MarkCopy Toggle >', cColor )
DispOutAt( ++nRow, nCol, '< F3 Resize Toggle >', cColor )
DispOutAt( ++nRow, nCol, '< F4 Closable Toggle >', cColor )
DispOutAt( ++nRow, nCol, '< F5 Palette L Repeat >', cColor )
DispOutAt( ++nRow, nCol, '< F6 Palette D Repeat >', cColor )
DispOutAt( ++nRow, nCol, '< F7 Palette By Index R >', cColor )
DispOutAt( ++nRow, nCol, '< F8 MarkCopy menu text >', cColor )
DispOutAt( ++nRow, nCol, '< Click Other Window >', cColor )
DispOutAt( ++nRow, nCol, '< Click X Button >', cColor )
DispOutAt( ++nRow, nCol, '< F9 New Console >', cColor )
DispOutAt( maxrow(), 0, Space( maxcol()+1 ), "N/G*" )
DispOutAt( 0, 0 , "TL", "N/GR*" )
DispOutAt( 0, MaxCol() - 1 , "TR", "N/GR*" )
DispOutAt( MaxRow(), 0 , "BL", "N/G*" )
DispOutAt( MaxRow(), MaxCol() - 1, "BR", "N/G*" )
DispEnd()
RETURN NIL
//----------------------------------------------------------------------
//
PROCEDURE HB_GTSYS()
REQUEST HB_GT_WVT
REQUEST HB_GT_WIN
RETURN
//----------------------------------------------------------------------
//
PROCEDURE HB_GT_WVT_DEFAULT()
RETURN
//----------------------------------------------------------------------
//
FUNCTION SetPalette( nMode )
Local aPalette := Hb_GtInfo( HB_GTI_PALETTE )
static nR := 198
static nG := 198
static nB := 198
nR += if( nMode == 0, -5, 5 )
nG += if( nMode == 0, -5, 5 )
nB += if( nMode == 0, -5, 5 )
// Change 'W' to slightly gray everytime you press F5
//
aPalette[ 8 ] := RGB( nR, nG, nB )
Hb_GtInfo( HB_GTI_PALETTE, aPalette )
DispScreen()
RETURN NIL
//----------------------------------------------------------------------
//
FUNCTION SetPaletteIndex()
Hb_GtInfo( HB_GTI_PALETTE, 8, RGB( 120, 200, 240 ) )
DispScreen()
RETURN NIL
//----------------------------------------------------------------------
//
FUNCTION NewWindow()
Local nWnd, nKey
Local nWndOld := Hb_WndSelect()
Local aColor := { 'W+/B', 'W+/BG', 'N/RB', 'W+/G', 'N/GR*' }
Local aFont := { 'Courier New', 'Lucida Console', 'Terminal',
'Ariel',
'Times New Roman' }
Local aPalette
Static nIndex := 0
Static nBottom := 40
Static nRight := 100
nIndex++
if nIndex > 5
nIndex := 1
endif
nBottom -= 2
nRight -= 4
if ( nWnd := Hb_WndCreate( 10, 10, nBottom, nRight ) ) > 0
Hb_GtInfo( HB_GTI_CLOSABLE, .F. )
Hb_GtInfo( HB_GTI_WINTITLE, 'Harbour Multi Console Window' )
Hb_GtInfo( HB_GTI_FONTNAME, aFont[ nIndex ] )
Hb_GtInfo( HB_GTI_FONTSIZE, 18 )
aPalette := Hb_GtInfo( HB_GTI_PALETTE )
Hb_GtInfo( HB_GTI_PALETTE, 5 /* RED */, aPalette[ 5 ] + ( nIndex *
10000 ) )
SetColor( aColor[ nIndex ] )
CLS
DispOutAt( maxrow(), 0, padc( 'Press F9 for another console!',
maxcol()+1 ), 'W+/R' )
SetPos( 0, 0 )
?
? 'Type some characters...'
do while .t.
nKey := Inkey()
do case
case nKey == K_ESC
exit
case nKey == K_F9
NewWindow()
case nKey <> 0
?? chr( nKey )
endcase
enddo
Hb_WndDestroy( nWnd )
Hb_WndSelect( nWndOld )
endif
RETURN NIL
//----------------------------------------------------------------------
//
--
View this message in context:
http://www.nabble.com/Multi-Window-GTWVT---First-Implementation-tp178577
24p17858267.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lorenzo
Fiorini
Sent: Thursday, August 07, 2008 6:40 PM
To: Harbour Project Main Developer List.
Subject: [Harbour] Anyone using color palettes functions?
I'm trying to use color palettes functions instead of using modified
gtwvt.h and gtxwc.c but from the code I can't see the correct syntax.
Is there anyone with some lines of working code?
best regards,
Lorenzo
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour