I try insert a timer after draw the line and refresh the dialog but it sometimes run
test sample
- Code: Select all Expand view
- #include "fivewin.ch"
#include "constant.ch"
static oDlgMain
Function Test()
Local nBottom := 22
Local nRight := 66
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
DEFINE DIALOG oDlgMain ;
TITLE "test" ;
SIZE nWidth, nHeight PIXEL ;
STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION, 4 )
ACTIVATE DIALOG oDlgMain center ;
ON INIT (ShowButtonLines())
RETURN NIL
//-------------------------------------------------------------------------------------------------------------//
Function ShowButtonLines()
Local ob[5]
Local oFont
local hsize:= 15
local Vsize:= 15
Local hdc:= oDlgMain:GetDc()
DEFINE FONT oFont NAME "MS SANS SERIF" SIZE 0,-12
@ 50,10 BTNBMP ob[1] OF oDlgMain ;
SIZE hsize,Vsize ;
PROMPT "1" 2007 ;
FONT oFont BOTTOM ;
ACTION Temporizzatore(1,oDlgMain)
ob[2]:lEllipse = .T.
return nil
//----------------------------------------------------------------------------------------------------------------//
Function Temporizzatore(nIndex,oDlg)
Local oOutLic
Local nInterval := 1000
Local nTimeLic:= 0
DEFINE TIMER oOutLic INTERVAL nInterval OF oDlg ;
ACTION ( nTimeLic ++, if ( nTimeLic == 2, (oOutLic:end(),oDlg:refresh()),Show_Paylines(nIndex,oDlg) ))
ACTIVATE TIMER oOutLic
return nil
//--------------------------------------------------------------------------------------------------------------------------------//
Static Function Show_Paylines(nIndex,oDlg)
Local stop_interval := 30000
local cc := 0
local hdc:= oDlg:getDc()
Do case
case nIndex= 1
Disegna_Linea( hDC, 160, 30, 160, 320, CLR_HRED,1 )
case nIndex= 2
case nIndex= 3
case nIndex= 4
case nIndex= 5
endcase
return nil
//-----------------------------------------------------------------------------------------------------------//
STATIC FUNCTION Disegna_Linea( hDC, nTop, nLeft, nBottom, nRight, nColor,nTipo )
LOCAL hPen := CREATEPEN( PS_SOLID, 4, nColor )
LOCAL hOldPen := SELECTOBJECT( hDC, hPen )
do case
case nTipo = 1
MOVETO( hDC, nLeft, nTop )
LINETO( hDC, nRight, nTop )
case nTipo = 2
MOVETO( hDC, nRight, nBottom )
LINETO( hDC,nBottom, nRight )
case nTipo = 3
MOVETO( hDC,nLeft, nTop)
LINETO( hDC, nBottom, nRight )
endcase
SELECTOBJECT( hDC, hOldPen )
DELETEOBJECT( hPen )
RETURN NIL