Acceleration DC_GetProgress

This forum is for eXpress++ general support.
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Acceleration DC_GetProgress

#11 Post by Eugene Lutsenko »

Eugene Lutsenko wrote:And where to insert this code?
Auge_Ohr wrote:

Code: Select all

   xMax     := Lastrec()
   nEvery   := INT(xMax/100)
   xScale   := xMax*nEvery                   // Scale to 100%

   oProgress:Minimum          := 0
   oProgress:Maximum          := xMax
   oProgress:nScaleMax        := xScale
   oProgress:Increment        := nEvery
I tried to implement a similar idea in his version of the progress bar, but much more primitive way. Now I see that in the way not failed.
?

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Acceleration DC_GetProgress

#12 Post by rdonnay »

I am very busy today. I will dig into this conversation tomorrow morning and see if I can help you.
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Acceleration DC_GetProgress

#13 Post by Eugene Lutsenko »

Thank you. I did so:

Code: Select all

STATIC FUNCTION Time_Progress (Time_Progress, Wsego, oProgress, lOk)

     LOCAL nMaxCount: = Wsego

     xtime = Time_Progress

     ** Display takes a very long time, so
     ** If Wsego> 100 not show progress for all x,
     ** But only for those that are entirely divided into Wsego / 100

     IF xtime = 0 .OR. xtime = Wsego .OR. Wsego <100 // Always show progress at the beginning and end of the process
     ELSE // and a small number of events: Wsego <100
        Wsego100 = ROUND (Wsego / 100,0)
        IF xtime <> Wsego100 * INT (xtime / Wsego100)
           RETURN lOk
        ENDIF
     ENDIF

     *** Time display performance
    ........

Code: Select all

***********************************************************************************************************
****** Graphical progress bar (on the basis of an example XSample_14 () xdemo.exe)
***********************************************************************************************************
STATIC FUNCTION Time_Progress (Time_Progress, Wsego, oProgress, lOk)

    LOCAL nMaxCount: = Wsego

    xtime = Time_Progress

    ** Display takes a very long time, so
    ** If Wsego> 100 not show progress for all x,
    ** But only for those that are entirely divided into Wsego / 100

    IF xtime = 0 .OR. xtime = Wsego .OR. Wsego <100 // Always show progress at the beginning and end of the process
    ELSE // and a small number of events: Wsego <100
       Wsego100 = ROUND (Wsego / 100,0)
       IF xtime <> Wsego100 * INT (xtime / Wsego100)
          RETURN lOk
       ENDIF
    ENDIF

    *** Time display performance

    ***** The process can go more than a day, so to determine
    ***** In all cases it calculated the time elapsed since the beginning of the year
* T_Mess1 = "Start:" + TIME () // Home

    ***** It took seconds to start the process
    PUBLIC T_Mess2: = "ch: mi: se"
    Sec_2 = (DOY (DATE ()) - 1) * 86400 + SECONDS () - Sec_1
    ch2 = INT (Sec_2 / 3600) // Watch
    mm2 = INT (Sec_2 / 60) -ch2 * // 60 Minutes
    cc2 = Sec_2-ch2 * 3600-mm2 * // 60 Seconds
    T_Mess2 = "passed:" + ALLTRIM (STRTRAN (T_Mess2, "ch", STR (ch2,19)))
    T_Mess2 = STRTRAN (T_Mess2, "mi", STRTRAN (STR (mm2,2), "", "0"))
    T_Mess2 = STRTRAN (T_Mess2, "se", STRTRAN (STR (cc2,2), "", "0"))
    * @ 19,2 SAY T_Mess2 + "of all:" + ALLTRIM (STR (Sec_2,17)) + "s."

    PUBLIC T_Mess3: = "ch: mi: se" // Left
    Sec_3 = Sec_2 * Wsego / xtime // Progn.dlit.isp. in seconds
    ch3 = INT (Sec_3 / 3600) // Watch
    mm3 = INT (Sec_3 / 60) -ch3 * // 60 Minutes
    cc3 = Sec_3-ch3 * 3600-mm3 * // 60 Seconds
    T_Mess3 = ALLTRIM (STRTRAN (T_Mess3, "ch", STR (ch3,19)))
    T_Mess3 = STRTRAN (T_Mess3, "mi", STRTRAN (STR (mm3,2), "", "0"))
    T_Mess3 = STRTRAN (T_Mess3, "se", STRTRAN (STR (cc3,2), "", "0"))
    * @ 20,2 SAY T_Mess3 + "of all:" + ALLTRIM (STR (Sec_3,17)) + "s."

    PUBLIC T_Mess4: = "ch: mi: se" // End
    Sec_4 = Sec_1 + Sec_3 - (DOY (DATE ()) - 1) * 86400
    ch4 = INT (Sec_4 / 3600) // Watch
    mm4 = INT (Sec_4 / 60) -ch4 * // 60 Minutes
    cc4 = Sec_4-ch4 * 3600-mm4 * // 60 Seconds
    T_Mess4 = "End:" + ALLTRIM (STRTRAN (T_Mess4, "ch", STR (ch4,19)))
    T_Mess4 = STRTRAN (T_Mess4, "mi", STRTRAN (STR (mm4,2), "", "0"))
    T_Mess4 = STRTRAN (T_Mess4, "se", STRTRAN (STR (cc4,2), "", "0"))
    * @ 21,2 SAY T_Mess4 + "of all:" + ALLTRIM (STR (Sec_4,17)) + "sek.s nach.sutok"

    PUBLIC T_Mess5: = "Sredn.vremya processing 1st object: ch: mi: se"
    Sec_5 = Sec_2 / xtime
    ch5 = INT (Sec_5 / 3600) // Watch
    mm5 = INT (Sec_5 / 60) -ch5 * // 60 Minutes
    cc5 = Sec_5-ch5 * 3600-mm5 * // 60 Seconds
    T_Mess5 = ALLTRIM (STRTRAN (T_Mess5, "ch", STR (ch5,19)))
    T_Mess5 = STRTRAN (T_Mess5, "mi", STRTRAN (STR (mm5,2), "", "0"))
    T_Mess5 = STRTRAN (T_Mess5, "se", STRTRAN (STR (cc5,2), "", "0"))
    * @ 22,2 SAY T_Mess5 + "of all:" + ALLTRIM (STR (Sec_5,17)) + "s."

    PUBLIC T_Mess6: = "ch: mi: se" // Left
    Sec_6 = Sec_3 - Sec_2
    ch6 = INT (Sec_6 / 3600) // Watch
    mm6 = INT (Sec_6 / 60) -ch6 * // 60 Minutes
    cc6 = Sec_6-ch6 * 3600-mm6 * // 60 Seconds
    T_Mess6 = "Left:" + ALLTRIM (STRTRAN (T_Mess6, "ch", STR (ch6,19)))
    T_Mess6 = STRTRAN (T_Mess6, "mi", STRTRAN (STR (mm6,2), "", "0"))
    T_Mess6 = STRTRAN (T_Mess6, "se", STRTRAN (STR (cc6,2), "", "0"))
    * @ 23,2 SAY T_Mess6 + "of all:" + ALLTRIM (STR (Sec_6,17)) + "s."

    Mess98 = T_Mess1 + SPACE (142-LEN (T_Mess1) -LEN (T_Mess4)) + T_Mess4 // Start, end (forecast) 145
    oSay98: SetCaption (Mess98); oSay98: SetCaption (oSay98: caption)

    Mess99 = T_Mess2 + SPACE (144-LEN (T_Mess2) -LEN (T_Mess6)) + T_Mess6 // passed, left (forecast) 146
    oSay99: SetCaption (Mess99); oSay99: SetCaption (oSay99: caption)

    DC_GetProgress (oProgress, Time_Progress) // Display graphic Progress-bar
    DC_AppEvent (@lOk, 0, .01)

RETURN lOk
[/size]


Treatment:

lOk = Time_Progress (++Time_Progress, Wsego, oProgress, lOk )

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: Acceleration DC_GetProgress

#14 Post by Auge_Ohr »

Eugene Lutsenko wrote:Thank you. I did so:
try

Code: Select all

IF nCurrCount % Int(nEvery) # 0
    Show_Progress( .... )
ENDIF
greetings by OHR
Jimmy

Post Reply