Implementing a Cancel button to a lengthy operation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Implementing a Cancel button to a lengthy operation

The Brave Sir Robin-2
I'm currently converting a C++ program which performs a lengthy operation.
As this may take a long time, I want my GUI to allow the user to press a
"Cancel" button to stop the operation.

What is the best way to achieve this in Dolphin? Using a Process ? Making a
regular call to a GUI event dispatcher inside the loop of my operation (if
so how) ?

Any example code would be helpful.

My C++ program uses a thread to run the operation and queries the state of
a flag set by the GUI to see if "Cancel" has been pressed.

Cheers,

The Brave Sir Robin.
RUN AWAY !!!


Reply | Threaded
Open this post in threaded view
|

Re: Implementing a Cancel button to a lengthy operation

Esteban A. Maringolo-3
The Brave Sir Robin escribió:
> I'm currently converting a C++ program which performs a lengthy operation.

> As this may take a long time,

The conversion or the operation? ;-)

> I want my GUI to allow the user to press a
> "Cancel" button to stop the operation.
> What is the best way to achieve this in Dolphin? Using a Process ? Making a
> regular call to a GUI event dispatcher inside the loop of my operation (if
> so how) ?

Use the ProgressDialog Luke.

See ProgressDialog example1, 2 and 3.

Best regards.

--
Esteban.