Announcement

Collapse
No announcement yet.

StatusDlg.IsCancelled(); if/else not working for me.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #1
    I think you need to go back to the start and re-read the manual as no where does it say the Hide() function returns anything to do with the cancel function.

    What you want to look at is
    PHP Code:
    canned StatusDlg.IsCancelled(); 
    The reason your having problems is your not reading them, most functions follow the logic there named after there for Hide is NOT the right function, please go back and read the manual not guess them manual.

    The manual and function dialog for StatusDlg.Hide() is clear it returns nothing not a dicky bird.
    Plugins or Sources MokoX
    BunnyHop 2021 Here

    Comment


    • #2
      Hi ,
      Yes your code was wrong as pointed out by kingzooly
      I think there is a bug in the Iscancelled function going back to 7, tried different variants - didn't work
      You could try this as it works -

      Code:
      StatusDlg.Show(MB_ICONNONE, false);
      StatusDlg.ShowCancelButton(true, "Cancel This Behemoth of an Install Process!");
      --StatusDlg.SetTitle("Extracting Files....");
      --canned = StatusDlg.Hide();
      --StatusDlg.ShowCancelButton(true, "Abort");
      Zip.Extract("AutoPlay\\Docs\\WinXP_Sample_Pics.zip", {"*.*"}, "C:\\Temp\\", true, true, "", ZIP_OVERWRITE_ALWAYS, nil);
      
      if StatusDlg.IsCancelled() then
              StatusDlg.SetTitle("Cancelling extraction ...");
              Application.Sleep(5000);--Allows user to see title
              StatusDlg.Hide();
              Dialog.Message("Notice", "you have stopped the install please read this blah", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
              return false; --pressed abort-stop asap
              
              else
              
              Dialog.Message("Install finished", "You have finished the extraction now installing blah", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
              
              StatusDlg.Hide();
              return true; --continue copying
              
          end
      Cheers

      Comment


      • #3
        Hi graphix3000 sorry I missed your second post

        Played around with your code again & realised canned variable was not being monitored, but if it put on timer it would be
        checked at any time during extraction when cancel button pressed.
        Page On Timer :
        Code:
        canned = StatusDlg.IsCancelled()
        On Button (or whatever calls your code):
        Code:
        StatusDlg.Show(MB_ICONNONE, false);
        StatusDlg.ShowCancelButton(true, "Cancel This Behemoth of an Install Process!");
        --canned = StatusDlg.IsCancelled() <--Place this in Page on timer
        Page.StartTimer(100, 10); -- Set to 100Ms can change
        
        Zip.Extract("AutoPlay\\Docs\\Download\\Download.zip", {"*.*"}, "C:\\Temp\\", true, true, "", ZIP_OVERWRITE_ALWAYS, nil);
        
        if canned then
        StatusDlg.SetTitle("Cancelling extraction ...");
        Application.Sleep(5000);--Allows user to see title
         Dialog.Message("Notice", "you have stopped the install please read this blah", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
        StatusDlg.Hide();
        
        else
        
        StatusDlg.Hide();
        Dialog.Message("Install finished", "You have finished the extraction now installing blah", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
        
        end
        You can try either scripts, see how you go
        Cheers

        Comment

        Working...
        X