draw a line for 5 seconds

draw a line for 5 seconds

Postby Silvio.Falconi » Tue Dec 01, 2015 10:10 pm

I must show a line on a dialog for 5 second when I press a button

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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: draw a line for 5 seconds

Postby ukoenig » Wed Dec 02, 2015 9:07 pm

Silvio,

have a look at

viewtopic.php?f=3&t=31628&p=184653#p184653

best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: draw a line for 5 seconds

Postby Silvio.Falconi » Thu Dec 03, 2015 8:32 am

Uwe,
the idea can be good but
I use the functions
DRAW_BOX1(oDlg)
DRAW_BOX2(oDlg)
AUTODELETE(oDlg)

and give me this error

Code: Select all  Expand view
Total memory allocated: 699410 bytes (40185 blocks)
WARNING! Memory allocated but not released: 1732 bytes (18 blocks)
source\compiler\hbpcode.c(680) hb_compGenPCode3() Block 1 0xb11aa4 (size 100) "$õ.l7d_.yyyyyyyd..l7d_.yyyyyyyd."
source\compiler\harbour.c(709) hb_compVariableAdd() Block 2 0xb136b0 (size 28) "\38\08\B0\00\00\00\00\00\03\00\00\00\F4\03\00\00\20\A0\B2\00\C8\00\90\00\00\00\00\00"
source\compiler\harbour.c(1844) hb_compFunctionNew() Block 3 0xb2a3b0 (size 164) "\00\00\00\00\00\00\00\00\02\00\39\00\01\00\00\00\B0\36\B1\00\00\00\00\00\00\00\00\00\00\00\00\00"
source\compiler\harbour.c(709) hb_compVariableAdd() Block 4 0xb229c8 (size 28) "\14\89\B2\00\00\00\00\00\01\00\00\00\F1\03\00\00\20\00\00\00\11\00\00\00\00\00\00\00"
source\compiler\hbpcode.c(680) hb_compGenPCode3() Block 5 0xb1bf10 (size 100) "\0D\00\00\74\00\00\49\00\B0\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\57\B6\49\00\01\00\00\00"
source\compiler\harbour.c(1844) hb_compFunctionNew() Block 6 0xb228c4 (size 164) "\44\E4\B1\00\00\00\00\00\02\00\10\00\01\00\00\00\C8\29\B2\00\00\00\00\00\00\00\00\00\00\00\00\00"
source\compiler\harbour.c(709) hb_compVariableAdd() Block 7 0xb2e84c (size 28) "\1C\E0\B1\00\00\00\00\00\02\00\00\00\E8\03\00\00\20\00\86\01\6C\1A\64\6A\00\00\00\00"
source\compiler\harbour.c(709) hb_compVariableAdd() Block 8 0xb2e474 (size 28) "\D4\09\B2\00\00\00\00\00\02\00\00\00\E7\03\00\00\20\00\00\00\00\00\00\00\4C\E8\B2\00"
source\compiler\harbour.c(709) hb_compVariableAdd() Block 9 0xb2e434 (size 28) "\08\E5\B1\00\00\00\00\00\02\00\00\00\E6\03\00\00\20\00\01\00\38\00\00\00\74\E4\B2\00"
source\compiler\harbour.c(709) hb_compVariableAdd() Block 10 0xb1e538 (size 28) "\14\89\B2\00\00\00\00\00\03\00\00\00\E5\03\00\00\20\00\00\00\40\00\00\00\34\E4\B2\00"
source\compiler\hbpcode.c(658) hb_compGenPCode2() Block 11 0xb1be24 (size 200) "\0D\00\00\74\00\00\85\E7\03\7E\03\E8\03\86\01\7E\04\00\00\86\03\30\07\00\6C\38\64\0C\00\5F\03\59"
source\compiler\harbour.c(1844) hb_compFunctionNew() Block 12 0xb2090c (size 164) "\A4\32\B2\00\00\00\00\00\01\00\39\00\01\00\00\00\38\E5\B1\00\00\00\00\00\00\00\00\00\00\00\00\00"
source\compiler\harbour.c(2763) hb_compPrepareOptimize() Block 13 0xb2ef6c (size 16) "\0E\00\00\00\46\00\00\00\4C\00\00\00\7B\00\00\00"
source\compiler\hbpcode.c(747) hb_compGenPCodeN() Block 14 0xb231a8 (size 200) "\0D\00\00\74\00\00\85\DB\03\67\01\00\79\22\1C\2D\86\01\6C\1A\64\6A\1D\4D\69\20\64\69\73\70\69\61"
source\compiler\harbour.c(1844) hb_compFunctionNew() Block 15 0xb29f20 (size 164) "\1C\36\B1\00\00\00\00\00\01\00\2B\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
source\compiler\hbpcode.c(680) hb_compGenPCode3() Block 16 0xb2a130 (size 100) "\24\D5\03\6C\37\64\5F\01\5C\1E\5C\0A\5D\EA\01\5D\0E\01\5C\0A\5C\0A\5D\FF\00\5C\08\14\09\6C\37\64"
source\compiler\harbour.c(709) hb_compVariableAdd() Block 17 0xb2b05c (size 28) "\38\08\B0\00\00\00\00\00\03\00\00\00\D4\03\00\00\20\40\00\00\38\00\00\00\00\00\00\00"
source\compiler\harbour.c(1844) hb_compFunctionNew() Block 18 0xb2b500 (size 164) "\00\00\00\00\00\00\00\00\02\00\39\00\01\00\00\00\5C\B0\B2\00\00\00\00\00\00\00\00\00\00\00\00\00"
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: draw a line for 5 seconds

Postby Silvio.Falconi » Thu Dec 03, 2015 8:33 am

Uwe,
RUN OK BUT HERE NOT RUN
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: draw a line for 5 seconds

Postby ukoenig » Thu Dec 03, 2015 11:36 am

Silvio,

did You RECOMPILE the original sample ?

It seems inside Your App, something is missing.
I don't get any error-messages. ( tested on WINDOWS10 and FWH September 2015 )
A solution of Your other problem : moving a record of a DB,F is included as well.

The LINE-solution :
the Height of the BOX-function is defined with the pen-size and shows a line
NO extra-function needed.

best regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: draw a line for 5 seconds

Postby ukoenig » Thu Dec 03, 2015 1:27 pm

Added SINGLE-line painting on ion

Download :
http://www.pflegeplus.com/DOWNLOADS/Drawline1.zip

A mouseclick on any other control deletes the line

Image

best regards
Uwe :D
Last edited by ukoenig on Sat Dec 05, 2015 3:17 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: draw a line for 5 seconds

Postby Silvio.Falconi » Thu Dec 03, 2015 3:58 pm

Uwe,
I can draw the line but on my app it is different because the lines must be draw from a procedure and not from user :

function calc_reward(aCombinations)
Local payout := 0
Local partial_payout := 0
Local nRow:= 300
Local nCol:= 35
Local oFontSAY

DEFINE FONT oFontSAY NAME "MS SANS SERIF" SIZE 0,-12



// Line 2
partial_payout := calc_line(aCombinations[2][1], aCombinations[2][2], aCombinations[2][3])

LogFile( "test.txt", {"calc line 1",partial_payout } )

if (partial_payout > 0)


@ 300,ncol SAY "Line 2 pays " + str(partial_payout) OF oDlgMain SIZE 200,25 PIXEL FONT oFontSAY

payout += partial_payout


highlight_line(1)

Endif

....



return nil



the function highlight_line(1) must draw the line 1


Function highlight_line(nIndex)

Local hdc:= oDlgMain:GetDc()

do case
case nIndex= 1
DRAWBOX( hDC, 160, 30, 160, 320, CLR_HRED,1 )
case nIndex= 2
DRAWBOX( hDC, 60, 30, 60, 320, CLR_RED,1 )
case nIndex= 3
DRAWBOX( hDC, 260, 30, 260, 320, CLR_YELLOW,1 )
case nIndex= 4
DRAWBOX( hDC, 15, 26, 300, 300, CLR_BLACK,3 )
case nIndex= 5
DRAWBOX( hdc,300, 40, 300, 22, CLR_BLUE, 3 )
endcase

return nil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: draw a line for 5 seconds

Postby ukoenig » Thu Dec 03, 2015 6:30 pm

Silvio,

please keep the syntax :

A defined nIndex shows a different line

< Left, Top, Right, Bottom, Radius1, Radius2, Color, Pen > :!:
Index = 4 and Index = 5 is NOT clear

case nIndex= 1

DRAWBOX( hDC, 160, 30, 160, 320, CLR_HRED,1 )
RoundBox( hDC, 30, 160, 320, 161, 10, 10, CLR_HRED,1 )

case nIndex= 2
DRAWBOX( hDC, 60, 30, 60, 320, CLR_RED,1 )
case nIndex= 3
DRAWBOX( hDC, 260, 30, 260, 320, CLR_YELLOW,1 )
case nIndex= 4
DRAWBOX( hDC, 15, 26, 300, 300, CLR_BLACK,3 ) ???????????
case nIndex= 5
DRAWBOX( hdc,300, 40, 300, 22, CLR_BLUE, 3 ) ??????????


Draw a line
oBtn[1]:bGotFocus = { |nKey, nFlags| ( DRAW_LINE1(oDlg, 1), oDlg:Refresh() ) }

Delete the line on focus-change
oBtn[1]:bLostFocus = { |nKey, nFlags| ( DRAW_LINE1(oDlg, 0), oDlg:Refresh() ) }

// ---------------------- show SINGLE LINE or BOX -----

STATIC FUNCTION DRAW_LINE1(oDlg, nIndex)

// Left, Top, Right, Bottom, Radius1, Radius2, Color, Pen
oDlg:bPainted := < |hDC|
IIF( nIndex= 0, RoundBox( hDC, 0, 0, 0, 0, 0, 0, 0, NIL ), NIL )
IIF( nIndex= 1, RoundBox( hDC, 30, 160, 320, 161, 10, 10, CLR_HRED,1 ), NIL )
IIF( nIndex= 2, RoundBox( hDC, 30, 60, 320, 61, 10, 10, CLR_RED,1 ), NIL )
IIF( nIndex= 3, RoundBox( hDC, 30, 260, 320, 261, 10, 10, CLR_YELLOW,1 ), NIL )
IIF( nIndex= 4, RoundBox( hDC, 305, 608, 485, 609, 10, 10, CLR_BLACK,3 ), NIL )
IIF( nIndex= 5, RoundBox( hDC, 305, 300, 485, 301, 10, 10, CLR_BLUE, 3 ), NIL )
// difference between TOP and BOTTOM + 1

RETURN NIL
>


best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: draw a line for 5 seconds

Postby ukoenig » Sat Dec 05, 2015 3:18 pm

Some more tests and improvements

Download :
http://www.pflegeplus.com/DOWNLOADS/Drawline1.zip

Image

best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 118 guests