Using a Progress Indicator in a Dialog window

deepbluedeepblue Member Posts: 152
hello,

I have an application where some processing take a long time, and I need to have a Progress Indicator ina Dialog window.

What can I do?

Thanks!

Answers

  • HalMdyHalMdy Member Posts: 429
    Use a Dialog box with an indicator field.
    For details, see in the online help, fct Dialog.OPEN and Dialog.UPDATE
    Dialog.OPEN(String [, Variable1], ...)
    Dialog

    Data type: dialog

    Once you define this variable, you can open the dialog and then use other dialog functions.

    String

    Data type: text constant or code

    This string contains the text you want the system to display in the window. Use a back slash (\) to start a new line. Use pound signs (#) to insert variable values into the string, Place the pound signs where you want the system to substitute the variable value.

    If you use @ characters instead of #, the string can be used as an indicator. In this case, use @ characters only for the string, and let the variable be an integer. The limits of the indicator are 0 and 9999 - meaning that the integer you use for updating the indicator should have a value within this range.

    Hope that help ...
  • krikikriki Member, Moderator Posts: 9,118
    Some example:
    globals:
    Name DataType Subtype Length
    diaProgress Dialog
    intProgress Integer
    intProgressI Integer
    intProgressTotal Integer
    timProgress Time
    recSalesLine.RESET; // + filters
    diaProgress.OPEN('@1@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\',intProgress);
    intProgressTotal := recSalesLine.COUNT; // be carefull : this can be slow if filters don't use the key
                                            // SQL : use COUNTAPPROX, but this doesn't give an exact number
    timProgress := TIME;
    
    IF recSalesLine.FIND('-') THEN
      REPEAT
        // Progress bar
        intProgressI := intProgressI + 1;
        IF timProgress < TIME - 3000 THEN BEGIN // every 3 seconds
          timProgress := TIME;
          intProgress := ROUND(intProgressI / intProgressTotal * 10000,1);
          diaProgress.UPDATE;
        END;
    
        // other things you have to do
      UNTIL recSalesLine.NEXT;
    
    diaProgress.CLOSE;
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • deepbluedeepblue Member Posts: 152
    hi kriki,

    Thank you, it seems to work !!! but i have an error message during the process:

    overflow in the conversion of the type Decimal to Integer
    value:498,09

    what could i do?

    thank you!!
  • krikikriki Member, Moderator Posts: 9,118
    You have to define the "intProgress*" as integer.
    If you already did that, check if the error isn't in another point. I used that code already thousands of times and never had any problem.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • DenSterDenSter Member Posts: 8,307
    That's why the ROUND statement is in the code snippet. The progress bar only knows how to handle integer values from 0 to 10000.
  • krikikriki Member, Moderator Posts: 9,118
    DenSter wrote:
    That's why the ROUND statement is in the code snippet. The progress bar only knows how to handle integer values from 0 to 10000.
    I suppose he did that.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.