Another Minor item: orphan progress window

When using the importdatabase statement with a shared database, PanX opens a Progress window to show the progress of the import. However, it never closes it and there is no obvious to do that manually. So you will be left with one or more Progress windows open doing nothing after using the importdatabase statement.

I assume you have the tool bar turned off?

Yes. The toolbar is Not shown.

Far from a permanent solution, but for now I think you can close any open progress windows by running this code.

let openProgressWindowNumbers = 
    getformoption("_DialogAlertLib","Progress","clonewindownumbers")
looparray openProgressWindowNumbers,cr(),opwn
    window val(opwn)
    closeclonewindow
endloop

I didn’t actually test this code so typos are possible.

Question – does the progress window show the progress as the data uploads?

They have all been very small imports, but I don’t see any progress showing. Here is what they look like.

Your procedure worked. Thanks.

I probably would have seen that the moment I tried it, but thanks, that shows that the problem must really be in setting up the window, so that no further commands to it work (including changing the progress and closing the window). Hopefully something simple.

You may have noticed that this code was almost exactly one of the examples from the last session (clone windows). Didn’t expect it to be posting about it on the forum again in only a couple of days! :smiley:

Speaking of the progress window …

Is it ok to call ProgressAlert pinfo, -1, max more than once?

I’d like to do something like this to ensure the progress window always goes away upon completion.

Is this a reasonable approach? Or is there a better one? :smiley:
TIA!

// setup progress bar
ProgressAlert pinfo, 0, max
Try
    // setup loop "stuff"
    LoopArray a,cr(),aVal,ii
        // update progress
        ProgressAlert pinfo, ii, max
        // do some work here ... that may cause errors
    EndLoop
    // done working
Catch
    // cleanup any spurious progress windows when an error occurs
    ProgressAlert pinfo, -1, max
EndTry
ProgressAlert pinfo, -1, max

I haven’t investigated this, but I don’t see any reason you couldn’t do it this way, and avoid the question.

// setup progress bar
ProgressAlert pinfo, 0, max
Try
    // setup loop "stuff"
    LoopArray a,cr(),aVal,ii
        // update progress
        ProgressAlert pinfo, ii, max
        // do some work here ... that may cause errors
    EndLoop
    ProgressAlert pinfo, -1, max
    // done working
Catch
    // cleanup
    ProgressAlert pinfo, -1, max
EndTry

Ha! Yeah, that would probably work just as well.
Thanks, Dave.

Just need to ensure that any nested Try..Catch..EndTry statements either do the same thing, or call ThrowError xx to ensure the outermost Catch gets triggered.

Another approach, probably simpler.

// setup progress bar
ProgressAlert pinfo, 0, max
Try
    // setup loop "stuff"
    LoopArray a,cr(),aVal,ii
        // update progress
        ProgressAlert pinfo, ii, max
        // do some work here ... that may cause errors
    EndLoop
    // done working
Catch
    // ensure any spurious progress windows close
    nop
EndCatch
ProgressAlert pinfo, -1, max

Whether there is an error or not, that last ProgressAlert executes.

2 Likes