Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 11 of 11

Thread: StatusDlg

  1. #1
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    475

    StatusDlg

    Hallo everybody

    I was having some troubles with built-in StatusDlg and i thought to drop by and ask.
    If i want to use the built-in StatusDlg in order to let a user know that some files are being copied, if at the end of copying i let show the cancel button on the StatusDlg with the purpose to terminate the process it doesn't work, it doesn't do anything although i use a few simple commands to close the StatusDlg with the cancel button. The code that i use looks something like this;

    StatusDlg.Show(MB_ICONNONE, false);
    -- do smth here --
    StatusDlg.ShowCancelButton(true, "Cancel");
    result = StatusDlg.IsCancelled();

    if result == true then
    StatusDlg.Hide();
    end
    Does anybody know what is wrong with this code?

    Thanks in advance

  2. #2
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    What's in the "-- do smth here --" part?
    --[[ Indigo Rose Software Developer ]]

  3. #3
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    475
    Hello Lorne

    The idea is to copy some files from one location to another and StatusDlg is handy. So one can realise that something is going on (files are being copied) and when the copying it's finished the by clicking the cancel button (Finish) wich shows up at StatusDlg you hide StatusDlg.

    Thanks

  4. #4
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    I believe what you want to do is more something like this.

    StatusDlg.ShowCancelButton(true, "Cancel");
    StatusDlg.Show(MB_ICONNONE, false);
    -- do smth here --

    result = StatusDlg.IsCancelled();

    if result == true then
    StatusDlg.Hide();
    end

    You want to have the cancel function before the do something here that will actually give you something to cancel. Otherwise the code that checks to see if result == true happens before you can press the cancel button. Or as another thought, you could start a timer and put your if/then statement on the timer to check and see if the cancel button has been pressed.

    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  5. #5
    Join Date
    Jul 2003
    Posts
    712
    Hello,

    The way I read your post, you want the status Dialog up when you are copying files WITHOUT any type of button on it. Then, when the copying is finished, you want to display a "Finish" button, similar to buttons at the very end of setups.

    Assuming that's correct, let's go!

    The reason your code is not working the way you want it to is due to the way in which "IsCancelled" works. At the moment that action is run, it checks to see if the button has been pressed. Since the user couldn't possibly press the button before the action is run, result will always == false. The action checks if the button is pressed, it doesn't wait for the button to be pressed.

    There are a couple of ways to accomplish your goal.

    The easiest in terms of implimentation is this:
    Code:
    StatusDlg.Show();
    -- Do something here
    StatusDlg.Hide();
    
    Dialog.Message("Copy Complete", "Copy Complete, press 'OK' to continue");
    If you are heart-set on having a finish button, you'll have to use the page's timer to continuously check if the cancel button was pressed.

    Put this where your code is right now (where you want the copy to happen):
    Code:
    StatusDlg.Show(MB_ICONNONE, false);
    -- do smth here --
    StatusDlg.ShowCancelButton(true, "Cancel");
    
    -- adjust the below value as needed
    Page.StartTimer(100);
    Then, put this code on the On Timer event:
    Code:
    result = StatusDlg.IsCancelled();
    
    if result == true then
    StatusDlg.Hide();
    Page.StopTimer();
    end
    Hope that gets the ball rolling! Good luck.

  6. #6
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    475
    Hallo everybody
    I thank everybody's advise

    This is one example;
    -----------------------------------------------------------------------

    select_folder = Dialog.FolderBrowse("Please select a folder:", "AutoPlay\\Docs");

    if select_folder == "CANCEL" then
    result = Dialog.Message("Notice", "Canceled by user", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    else
    StatusDlg.Show(MB_ICONNONE, false);
    File.Copy("AutoPlay\\Docs\\*.*", select_folder, true, true, false, true, nil);
    get_error = Application.GetLastError();
    StatusDlg.Hide();

    if get_error == 0 then
    result = Dialog.Message("Notice", "Copying successful", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    else
    result = Dialog.Message("Notice", "Copying failed", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

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

    My point is that since i could attach a cancel button at StatusDlg i thought it was lot easier to program that cancel button to close the copy procedure, but at that time i didn't know how. That's why i asked. It seems meaningless to attach a cancel button at StatusDlg for 2 reasons;
    1-during the copy procedure the StatusDlg expand itself. It adopts itself (the length) to the changing of the link in it (from: etc etc etc, to: etc etc etc) That means that one side of StatusDlg is in the middle of the screen the other side is way out in the right side of the screen. So there is no way somebody can click that button since it is all the time on the move (even worse out of the screen)
    2-even if by some wonders i can click that cancel button it won't do any good since it can not be (easy) programmed.
    So this is how i wondered if there was some way to
    1-have this StatusDlg under control (the length)
    2-program that cancel button
    3-put my own text on StatusDlg
    I know that there are some options to put your own title, message etc but to me didn't work out. Anyway...

    thanks a lot

  7. #7
    Join Date
    Jul 2003
    Posts
    712
    Hello,

    You will definitely want to check out the callback function in the copy action.

    This function is called every time (i believe) a new file is being copied. The help file has excellent documentation on this.

    Then, you could just not output the path, or only the filename (using String.SplitPath), or whatever you want! the possibilities are endless.

    This way, you could display a cancel button if you want . . . and put an IsCancelled action there, and an ifstatement that returns a value if cancel was pressed.

    Take a peak, experiment. AutoPlay is definitely an extremely powerful tool with a bazillion options.

    Disclaimer: The above 'bazillion' statement was intended to make desmond sound smarter than he is . . . it in no way reflects the actual number of features in AutoPlay Media Studio.

  8. #8
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    No need to quality that statement, Des. With the ability to call DLLs and plugin support, AutoPlay really does give you a bazillion options.
    --[[ Indigo Rose Software Developer ]]

  9. #9
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Quote Originally Posted by Desmond
    AutoPlay is definitely an extremely powerful tool with a bazillion options.

    Disclaimer: The above 'bazillion' statement was intended to make desmond sound smarter than he is . . . it in no way reflects the actual number of features in AutoPlay Media Studio.
    A bazillion, that's a lot huh? Reminds me of the movie Get Shorty.

    Mr Escobar: You gave him the money.
    Bo: I gave him a key to a locker that had the money in it.
    Mr Escobar: Now why would you do that, put the money in a locker.
    Bo: Because there were a zillion DEA guys hanging around the Terminal.
    Mr Escobar: A zillion, that's a lot, huh?

    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  10. #10
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    475
    Hi there

    No doubt. The possibilities are unlimited with ams5. Just wondering how somethings can be done with less.
    The shortest way to connect two points is a straight line.

  11. #11
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    475
    I thought he said gazillion...

    Just kidding

Similar Threads

  1. StatusDlg and HTTP.TestConnection
    By Stefan_M in forum AutoPlay Media Studio 5.0
    Replies: 5
    Last Post: 04-30-2004, 12:55 AM
  2. StatusDlg...???
    By zymad in forum AutoPlay Media Studio 5.0
    Replies: 9
    Last Post: 03-26-2004, 01:21 PM
  3. Progress meter VS. StatusDlg
    By arnaud in forum AutoPlay Media Studio 5.0
    Replies: 4
    Last Post: 02-05-2004, 02:16 PM
  4. Bug with Application.Exit and StatusDlg
    By arnaud in forum AutoPlay Media Studio 5.0
    Replies: 10
    Last Post: 01-22-2004, 04:22 PM
  5. StatusDlg not hiding.
    By TJ_Tigger in forum AutoPlay Media Studio 5.0
    Replies: 3
    Last Post: 11-07-2003, 03:16 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