Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006
    Posts
    24

    How to cancel a Progress Bars screen running a for loop

    Hi.

    The very first screen in my setup is a progress bars screen.
    Within the "On Start" tab of this screen, I have a for loop that does a CRC
    comparison of every file on my CD.

    EG : for every item in my table, compare CRC.

    This way, I can at least prove that the CD-ROM drive can read every
    file on my CD, which contains over 5500 files.

    I have got everything working just fine, including incrementing the progress
    bars, and plenty of error detection.

    As this can take between 1 min to 5 mins depending on CD-ROM drive speed,
    I want to give the user the ability to "Skip" this screen.

    My Cancel button is labelled "&Skip", and the "On Cancel" tab has the following
    code....

    -----------------------------------------------------------------------
    -- These actions are performed when the Cancel button is clicked.

    local nResult = Dialog.Message("Confirm", "Are you sure that you skip the Validation Check ?", MB_YESNO, MB_ICONQUESTION);

    if(nResult == IDYES)then

    bCancelled = true;

    -- Log fact that validation check has been skipped.
    SetupData.WriteToLogFile("Notice The Validation Check has been skipped\r\n", true);

    Screen.Jump("To my desired screen");

    end
    -----------------------------------------------------------------------

    The problem is, I cannot figure out how to detect if the Cancel button has
    been clicked while my for loop is running.

    I tried nesting the following as the first set of code in the for loop....

    -------------------------------------
    if bCancelled == true then

    break;

    else

    -- do the rest of my actions..

    end
    -------------------------------------

    But this does not work !!

    When I click the Cancel / Skip button, it appears that the for loop is
    running so tight that the button never actually gets depressed and
    the for loop will not quit.

    Any ideas ?

  2. #2
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,862
    even more interesting; I did this in my start event:

    Code:
    local nBigNumber = 1000000;
    DlgProgressBar.SetRange(CTRL_PROGRESS_BAR_01, 0, nBigNumber);
    
    local x=0;
    for x=1,nBigNumber do
    DlgProgressBar.SetPos(CTRL_PROGRESS_BAR_01, x);
    end
    and it scans but almost right away -- the progres bar jumps to "100%"
    cancel button isn't visible. (but it's set to be visible)

    I used StatusDlg to do what you're doing -- while not as "elegant" as using a screen, it will work as you want.

    Code:
    -- Setup parameters for scan
      local nBigNumber = 1000000;
      local bCancelled = false;
      local x=0;
    
    -- Display pgoress bar
      StatusDlg.Show(0, false);
      StatusDlg.ShowCancelButton(true,"Skip");
      StatusDlg.SetMeterRange(0, nBigNumber);
    
    -- Do the scan
      for x=1,nBigNumber do
        StatusDlg.SetMessage("X is "..x);
        StatusDlg.SetMeterPos(x);
        bCancelled = StatusDlg.IsCancelled();
        if bCancelled then
          break;
        end
      end
    
    -- remove the dialog
      StatusDlg.Hide();
    
    -- Show that we sensed correctly what happened
      if bCancelled then
        Dialog.Message("Results","User skipped the scan");
      else
        Dialog.Message("Results","User did not cancel");
      end


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  3. #3
    Join Date
    Mar 2006
    Posts
    24
    Hi Jassing. Thanks for the responce.

    Yes, I agree. Maybe the only way to achieve this is to use status dialogue,
    which is a shame as it isn't as gracefull.

    I do have a number of Progress Bars screens that use the File.Copy action, although the copy action is not run through a for loop. Because the File.Copy action uses a function callback, it correctly senses the fact that the cancel button has been clicked.

    This made me think that maybe trying to create a fuction might achieve what I want, but I cant think of how to call the function whilst locked within the for loop.

    As usual, plenty of work to be done !!........ lol

Similar Threads

  1. Screen: Download File Progress
    By Brett in forum Setup Factory 8.0 Examples
    Replies: 13
    Last Post: 01-13-2007, 09:24 PM
  2. Progress Bars screen, On Start code is skipped
    By AxemanMK in forum Setup Factory 7.0
    Replies: 7
    Last Post: 09-21-2006, 02:15 PM
  3. HOWTO: Make a Media Player Object Go Full Screen
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-23-2002, 11:23 AM
  4. Progress Screen
    By csd214 in forum Setup Factory 6.0
    Replies: 4
    Last Post: 02-13-2002, 02:00 PM
  5. SUF6002: Progress Screen without User Interaction
    By Hajo in forum Setup Factory 6.0
    Replies: 0
    Last Post: 12-15-2001, 07:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts