Jump to content

app execution


jahlxx

Recommended Posts

I'm not UniGui master - but as I know it affect performance. Each window which You show as ShowModal create additional thread. So more ShowModal Windows You have - thread pool is growing - machine resource usage is growing. As I know suggested solution is still Anonymous Callback. I'm pretty sure You will find more info with forum "find" tool.

 

Best regards.

Link to comment
Share on other sites

Hi. Thanks for your opinion.

 

If this only affects to showmodal, is not a problem for me. I only use show modal in some circunstances and only in a few forms,

 

If this affects to more internal things, then it could be a problem. And that is my doubt. Only affects to showmodal?

 

Thanks.

Link to comment
Share on other sites

  • Administrators

Hi. Thanks for your opinion.

 

If this only affects to showmodal, is not a problem for me. I only use show modal in some circunstances and only in a few forms,

 

If this affects to more internal things, then it could be a problem. And that is my doubt. Only affects to showmodal?

 

Thanks.

 

It affects all modal  windows including MessageDlgs and ShowMessages unless yo explicitly call the Non-blocking version of those methods:

 

For example:

 

You must call

ShowMessage('Message', nil);

To make sure the non-blocking version is called.

 

 

While

ShowMessage('Message');

Will call the blocking version. ( Provided that EnableSynchronousOperations is True)

 

Other than that it highly depends on your application load. As I told it is better to use blocking calls only when needed and call non-blocking versions with callback in all other places.

Link to comment
Share on other sites

jahlxx, Write a sample VCL app that shows what you want, including the fact that it needs to be somewhat general.  Then I'll (we'll) refactor it to do it asynchronously.  

 

But to also directly respond to a previous post of yours:

 

 

I have a tuniedit..

 

In key press of some key, a form is displayes with the info of a table and the user select one row,

 

In the close of the form, the value of a field mus be returned, and must be captured for the initial tuniedit.

 

First of all, just so I understand, are you basically trying to handle a lookup window, data entry, type of scenario? (That's what it sounds like to me!)

 

So anyway, there's 2 ways that come to mind;

1) Pass the TUniEdit as parameter to the Modal form.  When it closes it itself assigns the selected value to the TUniEdit previously passed.  

 

2) As has been suggested: Refactor whatever code currently comes after the synchronous/linear ShowModal based code into a seperate procedure, such that this procedure expects the results of the Modal form to do its work.  Then, you pass this procedure to the Modal call of the form.  It then calls the procedure ("callback procedure"), passing in the values once the user confirm selection.  

 

And both of these suggestions are in some sense the same, and similar to what's already been suggested: you basically shift the code that must wait out of being embedded below a ShowModal call.

 

Hope that helps? (Maybe I'll create a small sample...)

Link to comment
Share on other sites

However: Have you looked at the uniGUI\Demos\Desktop\BlockingModals\bmodal.dproj project?  

 

The left top button appears to do *exactly* what you want, that is, show a Modal form then return the value and process it Synchronously?  The demo app has a note on the bottom saying: "In MainModule "EnableSynchronousOperations" property must be True".  Might this be a simpler way for you to accomplish what you want?

 

(That said, callbacks/asynchronous style of programming is very much becoming ever more relevant so it'd be very useful to wrap your head around it! :) )

Link to comment
Share on other sites

Thanks vprins.

 

You are right when you said: "are you basically trying to handle a lookup window, data entry, type of scenario?"

 

I've done some updates to my code, with showmodal forms, and everything works ok, with no performance less.

 

My doubt was if changing the option in uniservermodule, could affect to app performance in other things. But Farshad, clarified to me.

 

Thanks.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...