Page 1 of 1

TBackgroundWorker and modal windows

PostPosted: January 21st, 2013, 2:18 pm
by anom69
I have something like this:

Code: Select all
button click:
create window
execute thread
show window modal

window cancel button:
thread cancel

work event:
if cancellation pending then accept cancellation, display aborted and exit
execute slow function here


But this one can't display status aborted immediately, also after next button click component tell me that is already run.
How to fix it?

Also some cancel event or something similar will be nice, aren't they?

Re: TBackgroundWorker and modal windows

PostPosted: January 22nd, 2013, 5:38 pm
by Kambiz
The delay depends on the delay between the two consequent pending cancellation checks. In other words, it's just your code that defines how fast the thread should respond to a cancel request.
By the way, do not show the "aborted" message inside the thread. Generally all the UI interactions should be done in the main thread only.

Re: TBackgroundWorker and modal windows

PostPosted: January 24th, 2013, 2:17 pm
by anom69
No, this is report feedback for event only ;)

Could you show me sample how to use your component with modal windows?

Re: TBackgroundWorker and modal windows

PostPosted: January 24th, 2013, 5:00 pm
by Kambiz
Please send me a sample program with that problem to me, so that I know exactly what are you going to do and apply the fix. It will also save a lot of my time.