Author Topic: Please Wait negates ability to have a Cancel Button  (Read 394 times)

Please Wait negates ability to have a Cancel Button
« on: February 12, 2019, 02:18:03 PM »
I have an Inform Application that runs for quite a while, and would like to have a Cancel Button enabled for the user to stop the process at any time. I have no problem creating and displaying the Cancel Button, but unfortunately it cannot be clicked, because the entire window is darkened and overlaid with a "please wait" message.
Is there some way to either prevent the "please wait" or enable a button in the window whenever it is appropriate?

Thanks

Ron

Offline Pete

  • Cuz I sez so, varmint!
Re: Please Wait negates ability to have a Cancel Button
« Reply #1 on: February 12, 2019, 02:35:41 PM »
Please wait...

Offline FellippeHeitor

  • QB64 Developer
  • LET IT = BE
    • QB64.org
Re: Please Wait negates ability to have a Cancel Button
« Reply #2 on: February 12, 2019, 02:55:57 PM »
Hello.

You probably have a do/loop block that's hogging InForm's own update routines. If that's the case, add a call to __UI_DoEvents in your loop and all should work as expected.

Re: Please Wait negates ability to have a Cancel Button
« Reply #3 on: February 12, 2019, 04:58:27 PM »
That does work, but means, in at least one "real world" invocation, over 10,000 calls to the __UI_DoEvents routine (if the app runs to completion), just to support the ability to cancel the program after, say, 5000 iterations of the loop.
And lest you wonder: there are, of course (thanks to Inform), several visual clues as to the application's progress: there is a count-DOWN counter showing how many iterations remain, there is a nice green progress bar, there is a count-UP counter as to how many "hits" have resulted, and there is a display that is constantly updated showing what the application is currently evaluating.
To be honest, though, the extra calls don't slow the process down THAT much. :-)

Ron

Offline FellippeHeitor

  • QB64 Developer
  • LET IT = BE
    • QB64.org
Re: Please Wait negates ability to have a Cancel Button
« Reply #4 on: February 12, 2019, 05:28:46 PM »
Good to hear it's solved. Curious for your interface now!

Re: Please Wait negates ability to have a Cancel Button
« Reply #5 on: February 13, 2019, 05:06:04 AM »
Ron, glad to hear that you're using the marvellous resource that is InForm.

Re: Please Wait negates ability to have a Cancel Button
« Reply #6 on: February 13, 2019, 08:46:14 PM »
The utility, which I will upload some day (sooner if anyone shows interest), uses several of the Inform tool widgets: Buttons, Labels, Textboxes, Checkboxes, Radiobuttons, Frames, and Progressbars, and hides/displays them (including the main form, itself, at times) depending on what processing is taking place.
The utility's purpose is to compare selected file types (e.g. *.bas, *.cpp, *.txt) between two different Windows folders - including matching sub-folders, if requested, and with options to exclude specific files (using wildcards) or subfolders. Files being compared  that exist in both main, or matching sub-folders, will be compared taking specified options into consideration - e.g. file contents or attributes only; case sensitivity option, column limits option, whitespace options, line terminator options, etc. ). For each matching filename pair, the first difference will be logged, along with the line number and offset at which the mismatch was found. If requested the names of compared files and/or added/deleted files will also be logged.
I use the utility to compare original and work-in-progress version folders to verify that all changed/added/deleted elements have been accounted for. For my purposes, a difference in file dates is not significant (e.g. I could have made, then reversed, a change in the w-i-p  folder).
For a recent run, I compared two versions, each of which contained over 30,000 files, of which only about 7,000 in each met the file filters (included file-types,  excluded folders). The utility ran for about 6 minutes and identified 38 changes, plus a fair number of additions/deletions.
I wanted the "Cancel" button available in the event that  I noticed that the utility was "taking a long time" in a particular subfolder or on a particular file-type that I should have excluded in the filters. since they were not relevant. Without the excluded subfolders the utility would run twice as long (and I run it several times a week).