Problem with "timer + tprogress"

Post Reply
emotta_no
Posts: 33
Joined: Thu Jul 04, 2013 9:28 pm

Problem with "timer + tprogress"

Post by emotta_no »

I am having problems when I use a timer with a tprogress. What happens is that as soon as I call the SetPos of progress, the timer ignores the interval that was previous defined to it.

An example is when I create a timer with a 15 seconds interval and activate it. At the time I call the SetPos of progress, the timer starts to execute at every moment, ignoring the interval.

Follow an example of the code presenting this problem:

Code: Select all | Expand




    #include "fivewin.ch"
    Function U_NovoTeste()
    Local oTimer := TTimer(10000,{||oTimer:DeActivate(),MsgStop("TIMER1"),oTimer:Activate()},oWndMain)
    Local oTimer2 := TTimer(15000,{||oTimer2:DeActivate(),MsgStop("TIMER2"),oTimer2:Activate()},oWndMain)
    oTimer:Activate()
    oTimer2:Activate()
    Return U_Proc()




    Function U_Proc()
    Local oDlg
    Local oProgress

    DEFINE DIALOG oDlg FROM 0,0 TO 500,500 TITLE "TESTE" PIXEL

    oProgress := TProgress():New(50,00,oDlg,0,CLR_RED ,CLR_WHITE,.t.,.f.,oDlg:nWidth,8,,.f.,.f.)

    TButton():New( 10,10, "exec", oDlg, {||U_Progress(oProgress)}, 40, 40,;
                   , , , .t., , ,;
                   ,,, , ,)
                   

    ACTIVATE DIALOG oDlg

    Return


    Function U_Progress(oProgress)
    If MsgYesNo("Proc?")
        oProgress:SetPos(1)
    EndiF
    ThreadSleep(10)
    Return




    Function U_Teste()
    TFichaTreino_IMPSercice():Init("01")
    Return
     

digordo 
     
    Posts: 12
    Joined: Mon Aug 02, 2010 2:15 pm

Top

 
Post Reply