Abort long operation (For-cycle) from StatusBar-type ProgressBar (Esc-press?)

Abort long operation (For-cycle) from StatusBar-type ProgressBar (Esc-press?)

Maxim-CADman77
Advisor Advisor
439 Views
1 Reply
Message 1 of 2

Abort long operation (For-cycle) from StatusBar-type ProgressBar (Esc-press?)

Maxim-CADman77
Advisor
Advisor

One of my AddIns is supposed to perform a time-consuming operation (process of For-cycle).
Currently I provide user with ability to abort the operation by pressing the 'Cancel' button on Inventor ProgressBar (Dialog-type).
The ProgressBar is initialized "WithEvents", there is a Boolean variable and ProgressBar.OnCancel sub that changes the variable value.
Inside the For-Cycle there is also a condition that checks the value and initiates the exit if necessary.
Everything works as expected but ...
I don't like that Dialog-type ProgressBar is too big and overlaps the Graphical Window.
I'd like to change the type of ProgressBar to StatusBar but keep the Cancel option.


I do see StatusBar-type ProgressBar shows "<Esc> to Cancel ..." but I've discovered that Esc-press breaks current cycle iteration and calls the message:

MaximCADman77_0-1698909622084.png

... but this does not abort the whole cycle. As soon as I press 'OK' my command proceeds.


I'd like to know how to setup true cycle abort for StatusBar-type ProgressBar.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
440 Views
1 Reply
Reply (1)
Message 2 of 2

mfoster9TD82
Advocate
Advocate

I think you'd want to use the OnCancel event to activate a cancelation token, assuming your process is asynchronous. If not then you'll have to get creative to cancel your process, but regardless, you'll want to use the OnCancel event of ProgressBar

0 Likes