#include "FiveWin.ch"
#include "ttitle.ch"
STATIC lMessage1 := .F., nDlg := 1, oBar1, oTextFont, oSysFont1, oSysfont2, c_path
function Main()
local oWnd
local oMenu
menu oMenu
menuitem "Gradient" action Dlg_Grad()
menuitem "Color" action Dlg_Color()
menuitem "Bitmap" action Dlg_Bit()
endmenu
oTextfont := TFont():New( "Arial", 0, 14,.F.,.T., 0, 0, 0,.F.,.F.)
oSysfont1 := TFont():New( "Arial", 0, 16,.F.,.T., 0, 0, 0,.F.,.F.)
oSysfont2 := TFont():New( "Arial", 0, 22,.F.,.T., 0, 0, 0,.F.,.F.)
c_path := CURDRIVE() + ":\" + GETCURDIR()
DEFINE WINDOW oWnd TITLE "Test Say" from 0,0 to 400,800 pixel menu oMenu
activate window oWnd
oTextfont:End()
oSysFont1:End()
oSysfont2:End()
return nil
procedure Dlg_Grad
local oDlg1
local oSay
local oSay2
define dialog odlg1 title "Test Say With Gradient Brush" size 400,400 PIXEL TRANSPARENT
@ 2,2 to 100,100 of odlg1 pixel
@ 25,15 say oSay prompt "This a Test" of oDlg1 SIZE 40, 15 COLOR CLR_WHITE PIXEL adjust ;
FONT oTextfont
oDlg1:bLClicked := {| nRow, nCol | ( IIF( lMessage1 = .T., oBar1:End(), NIL ), ;
MsgAlert( "Your Action !","Attention" ) ) }
oDlg1:bMMoved := {| nRow, nCol | T_DISPLAY1(nRow, nCol, oDlg1, 1) }
@ 10,120 button "Test" pixel action ( oSay:SetText( "Change Text"), oDlg1:Refresh() )
ACTIVATE DIALOG oDlg1 CENTERED ;
ON INIT DLG_BRUSH( oDlg1, .F., nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ), 0.4 )
// GradientBrush( oDlg, { { 0.4, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) },;
// { 0.6, nRGB( 24, 61, 118 ), nRGB( 50, 95, 158 ) } } )
return
procedure Dlg_Color
local oDlg2
local oBrush
local oSay
define brush oBrush color CLR_CYAN
define dialog odlg2 title "Test Say With Color Brush" brush oBrush size 400,400 PIXEL TRANSPARENT
@ 2,2 say oSay prompt "This a Test" of oDlg2 SIZE 100, 130 COLOR CLR_WHITE PIXEL transparent ;
FONT oTextfont
oDlg2:bLClicked := {| nRow, nCol | ( IIF( lMessage1 = .T., oBar1:End(), NIL ), ;
MsgAlert( "Your Action !","Attention" ) ) }
oDlg2:bMMoved := {| nRow, nCol | T_DISPLAY1(nRow, nCol, oDlg2, 2) }
@ 10,120 button "Test" action oSay:SetText( "Change Text") pixel
ACTIVATE DIALOG oDlg2 CENTERED
return
procedure Dlg_Bit
local oDlg3
local oBrush
local oSay
define brush oBrush file "..\bitmaps\cara.bmp"
define dialog odlg3 title "Test Say With bitmap Brush" brush oBrush size 400,400 PIXEL TRANSPARENT
@ 2,2 say oSay prompt "This a Test" of oDlg3 SIZE 100, 130 COLOR CLR_WHITE PIXEL transparent ;
FONT oTextfont
oDlg3:bLClicked := {| nRow, nCol | ( IIF( lMessage1 = .T., oBar1:End(), NIL ), ;
MsgAlert( "Your Action !","Attention" ) ) }
oDlg3:bMMoved := {| nRow, nCol | T_DISPLAY1(nRow, nCol, oDlg3, 3) }
@ 10,120 button "Test" pixel action oSay:SetText( "Change Text")
ACTIVATE DIALOG oDlg3 CENTERED on init osay:refresh()
return
// ---------- using different Dialogs --------
FUNCTION T_DISPLAY1(nRow, nCol, oDlg, nDlg)
// Dialog 2 and 3
// -------------------
IF nRow >= 5 .and. nRow <= 15 .and. nCol >= 5 .and. nCol <= 60 .and. ( nDlg = 2 .or. nDlg = 3 )
IF lMessage1 = .F.
lMessage1 := .T.
SHOW_MSG1(oDlg, 1, 5, 15, 5, 60, ;
"Head Hotspot 2 + 3", ;
"Top : 5 ", ;
"Left : 5 ", ;
"Bottom : 15 ", ;
"Right : 60 ")
ENDIF
// Dialog 1
// -----------
ELSEIF nRow >= 52 .and. nRow <= 64 .and. nCol >= 30 .and. nCol <= 83 .and. nDlg = 1
IF lMessage1 = .F.
lMessage1 := .T.
SHOW_MSG1( oDlg, 1, 52, 64, 30, 83, ;
"Head Hotspot 1", ;
"Top : 52 ", ;
"Left : 30 ", ;
"Bottom : 64 ", ;
"Right : 83 ")
ENDIF
ELSEIF lMessage1 = .T.
// deleting these lines,
// Message stays open
// ---------------------------
oBar1:End()
lMessage1 := .F.
ENDIF
RETURN ( NIL )
// ----------------------
FUNCTION SHOW_MSG1(oDlg, nSpot,nSTop,nSBott,nSLeft,nSRight, cHead, cText1, cText2, cText3, cText4)
Local oTitle, oText1, oText2, oText3, oText4, oBmp1, oBmp2
Local nTop := nSBott + 2, nLeft := nSRight + 2
IF nSTop + 162 > oDlg:nHeight - 50
nTop := nSTop - 162
ENDIF
IF nSLeft + 252 > oDlg:nWidth
nLeft := nSLeft - 252
ENDIF
@ nTop, nLeft TITLE oBar1 SIZE 250, 160 OF oDlg SHADOW BOTTOMRIGHT SHADOWSIZE 10
@ 15, 55 TITLETEXT oTitle OF oBar1 TEXT cHead FONT oSysfont2 COLOR 128
@ 50, 20 TITLETEXT oText1 OF oBar1 TEXT cText1 FONT oSysfont1 COLOR 0
@ 75, 20 TITLETEXT oText2 OF oBar1 TEXT cText2 FONT oSysfont1 COLOR 0
@ 100, 20 TITLETEXT oText3 OF oBar1 TEXT cText3 FONT oSysfont1 COLOR 0
@ 125, 20 TITLETEXT oText4 OF oBar1 TEXT cText4 FONT oSysfont1 COLOR 0
@ 10, 15 TITLEIMG oBmp1 OF oBar1 BITMAP "..\bitmaps\Info.BMP" SIZE 30, 30 ANIMA LEVEL 255 ;
ACTION MsgAlert( "Action from here !","Attention" )
oBar1:lRound := .T.
oBar1:lBorder := .T.
oBar1:nClrLine1 := 255
IF FILE( "..\Bitmaps\Backgrnd\Stone.Bmp" )
oBar1:aGrdBack := {}
DEFINE BRUSH oBrush FILENAME "..\bitmaps\backgrnd\Stone.Bmp"
SET BRUSH OF oBar1 TO oBrush
RELEASE BRUSH oBrush
ELSE
MsgAlert( "File : Stone.Bmp" + CRLF + ;
"does not exist" + CRLF + ;
"to create Brush !", "ATTENTION" )
ENDIF
@ 100, 190 TITLEIMG oBmp2 OF oBar1 BITMAP "..\bitmaps\Exit.BMP" SIZE 30, 30 ANIMA LEVEL 255 ;
ACTION ( lMessage1 := .F., oBar1:End() )
RETURN( NIL )
// ------------------------
FUNCTION DLG_BRUSH( oDlg1, lDirect, nVColor, nBColor, nMove )
LOCAL hDC, oBrush, oTmp
LOCAL aRect := GETCLIENTRECT( oDlg1 )
LOCAL aGrad := { { nMove, nVColor, nBColor }, { nMove, nBColor, nVColor } }
hDC = CreateCompatibleDC( oDlg1:GetDC() )
hBmp = CreateCompatibleBitMap( oDlg1:hDC, oDlg1:nWidth, oDlg1:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, oDlg1:nHeight, oDlg1:nWidth, aGrad, lDirect )
DeleteObject( oDlg1:oBrush:hBrush )
oBrush := TBrush():New( ,,,, hBmp )
oBrush:Cargo := aGrad
SelectObject( hDC, hBmpOld )
oDlg1:ReleaseDC()
oDlg1:SetBrush( oBrush )
RELEASE BRUSH oBrush
RETURN NIL