Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8153887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:09:43+00:00 2026-06-06T16:09:43+00:00

To make things simple, my Delphi XE application contains objects in charge of generating

  • 0

To make things simple, my Delphi XE application contains objects in charge of generating files based on some conditions: one object can generate a text file, other objects (which inherits from the former) can generate an XML or HTML files and so on… All of them have a common ancestor but do not run on a thread!

I’m now trying to add a way to cancel the whole generation process whenever the user hits the cancel button. The problem is that I’ve got nothing in place for this to work. The most basic action would be to add A LOT of if user_canceled then halt_process all over the place throughout the generation process but I feel this isn’t the optimal solution.

My question, is to know if there is some smarter way of doing this ? Or any recommendation you might have on refactoring my code so that this addition could be better integrated in the future when more generation code (and therefore cancellation tests) needs to be added ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:09:44+00:00Added an answer on June 6, 2026 at 4:09 pm

    You will need to add manual checks if process needs to be canceled because there’s no way to cancel it and leave the program in valid state. Compiler/Program just does not knows which operations are atomic and which not in your applications logic.

    E.g.

    OpenFile(...);  //<- if program halts anywhere before CloseFile you have the file locked
    ...
    CloseFile;
    

    Optimal solution depends on your existing design a lot. In simple case of queued actions A -> B -> C -> D it would work if you wrap it into a thread and add if Terminated then Exit; between actions (of course properly freeing temp objects if any).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To make things simple I thought I could add some settings in my resources
My boss believes that wizards make things simple for the user. I think they
One of the first things I like to do when I make a site
Make things as simple as possible, but no simpler. Can we find the solution/s
Doctrine 2 integration into ZF seems to make simple things very hard and time
I've got a form with several controls (to make things simple, say it's a
I despise working with overengineered APIs that don't make simple things simple. Nonetheless, I'm
Helo, I had stuck with this problem. Just to make things simple i'll explain
My problem is a simple one. I've created a class library for Delphi 2007
EDIT: Just to make things clear, this problem was caused by a typo in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.