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

  • SEARCH
  • Home
  • 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 120393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:48:15+00:00 2026-05-11T03:48:15+00:00

A certain form in our application displays a graphical view of a model. The

  • 0

A certain form in our application displays a graphical view of a model. The user can, amongst loads of other stuff, initiate a transformation of the model that can take quite some time. This transformation sometimes proceeds without any user interaction, at other times frequent user input is necessary. While it lasts the UI should be disabled (just showing a progress dialog) unless user input is needed.

Possible Approaches:

  1. Ignore the issue, just put the transformation code in a procedure and call that. Bad because the app seems hung in cases where the transformation needs some time but requires no user input.
  2. Sprinkle the code with callbacks: This is obtrusive – you’d have to put a lot of these calls in the transformation code – as well as unpredictable – you could never be sure that you’d found the right spots.
  3. Sprinkle the code with Application.ProcessMessages: Same problems as with callbacks. Additionally you get all the issues with ProcessMessages.
  4. Use a thread: This relieves us from the “obtrusive and unpredictable” part of 2. and 3. However it is a lot of work because of the “marshalling” that is needed for the user input – call Synchronize, put any needed parameters in tailor-made records etc. It’s also a nightmare to debug and prone to errors.

//EDIT: Our current solution is a thread. However it’s a pain in the a** because of the user input. And there can be a lot of input code in a lot of routines. This gives me a feeling that a thread is not the right solution.

I’m going to embarass myself and post an outline of the unholy mix of GUI and work code that I’ve produced:

type   // Helper type to get the parameters into the Synchronize'd routine:   PGetSomeUserInputInfo = ^TGetSomeUserInputInfo;   TGetSomeUserInputInfo = record     FMyModelForm: TMyModelForm;     FModel: TMyModel;     // lots of in- and output parameters     FResult: Boolean;   end;  { TMyThread }  function TMyThread.GetSomeUserInput(AMyModelForm: TMyModelForm;   AModel: TMyModel; (* the same parameters as in TGetSomeUserInputInfo *)): Boolean; var   GSUII: TGetSomeUserInputInfo; begin   GSUII.FMyModelForm := AMyModelForm;   GSUII.FModel := AModel;   // Set the input parameters in GSUII    FpCallbackParams := @GSUII; // FpCallbackParams is a Pointer field in TMyThread   Synchronize(DelegateGetSomeUserInput);   // Read the output parameters from GSUII   Result := GSUII.FResult; end;  procedure TMyThread.DelegateGetSomeUserInput; begin   with PGetSomeUserInputInfo(FpCallbackParams)^ do     FResult := FMyModelForm.DoGetSomeUserInput(FModel, (* the params go here *)); end;  { TMyModelForm }  function TMyModelForm.DoGetSomeUserInput(Sender: TMyModel; (* and here *)): Boolean; begin   // Show the dialog end;  function TMyModelForm.GetSomeUserInput(Sender: TMyModel; (* the params again *)): Boolean; begin   // The input can be necessary in different situations - some within a thread, some not.   if Assigned(FMyThread) then     Result := FMyThread.GetSomeUserInput(Self, Sender, (* the params *))   else     Result := DoGetSomeUserInput(Sender, (* the params *)); end; 

Do you have any comments?

  • 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. 2026-05-11T03:48:16+00:00Added an answer on May 11, 2026 at 3:48 am

    I think as long as your long-running transformations require user interaction, you’re not going to be truly happy with any answer you get. So let’s back up for a moment: Why do you need to interrupt the transformation with requests for more information? Are these really questions you couldn’t have anticipated before starting the transformation? Surely the users aren’t too happy about the interruptions, either, right? They can’t just set the transformation going and then go get a cup of coffee; they need to sit and watch the progress bar in case there’s an issue. Ugh.

    Maybe the issues the transformation encounters are things that could be ‘saved up’ until the end. Does the transformation need to know the answers immediately, or could it finish everything else, and then just do some ‘fix-ups’ afterward?

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

Sidebar

Related Questions

I would like to dynamically modify the values of certain form elements, more specifically
I have multiple MVC 3 forms that need form validation on certain fields (mostly
Can anyone guide me as to how to set a form to be enabled
I have a form where a user uploads an avatar, and it resizes the
i've got if/else in place to make sure only certain types of audio can
We offer multiple packages with features for our clients with Microsoft Dynamics CRM. Is
I have a data driven form generated on the fly from a database. The
When you code in other languages, you will sometimes create a block scope, like
I am developing a win form app and I found myself constantly requiring to
A little web design dilemma: I have a form with a lot of options,

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.