-
March 13th, 2022, 09:53 PM
#1
refresh dialog
Have a function as part of a dialog class which has some loops and so on and works. But during its run, the dialog needs its controls , etc. refreshed and update. For reasons can not use worker thread for this function. What's the best way to refresh/update dialog at the same time that the serial processes in this function are running. Without flickering.
-
March 14th, 2022, 02:41 AM
#2
Re: refresh dialog
Originally Posted by @EE@
Have a function as part of a dialog class which has some loops and so on and works. But during its run, the dialog needs its controls , etc. refreshed and update. For reasons can not use worker thread for this function. What's the best way to refresh/update dialog at the same time that the serial processes in this function are running. Without flickering.
1. And what are the reasons you "can not use worker thread for this function"?
2. The best way to use serial communication is to place the serial functions code in the secondary thread.
Victor Nijegorodov
-
March 14th, 2022, 10:32 AM
#3
Re: refresh dialog
If it's an MFC dialog, UpdateData should do it
-
March 15th, 2022, 01:25 AM
#4
Re: refresh dialog
Victor:
1. And what are the reasons you "can not use worker thread for this function"?
need something more deterministic. The thread operation does not quite sync with operation in the library it calls. need to give more control to the library function.
2. The best way to use serial communication is to place the serial functions code in the secondary thread.
yes.
Last edited by @EE@; March 15th, 2022 at 01:29 AM.
-
March 15th, 2022, 02:02 AM
#5
Re: refresh dialog
Originally Posted by @EE@
Victor:
1. And what are the reasons you "can not use worker thread for this function"?
need something more deterministic. The thread operation does not quite sync with operation in the library it calls. need to give more control to the library function.
Define " more deterministic".
The thread operation itsellf knows nothing about any "not quite sync with operation in the library". It's up to you how to "synchronize" these two operations.
Originally Posted by @EE@
Victor:
2. The best way to use serial communication is to place the serial functions code in the secondary thread.
yes.
Then just do it!
Victor Nijegorodov
-
March 15th, 2022, 02:07 AM
#6
Re: refresh dialog
Originally Posted by GCDEF
If it's an MFC dialog, UpdateData should do it
Of course it will!
However, the controls won't be updated until this function:
Originally Posted by @EE@
Have a function as part of a dialog class which has some loops and so on and works. But during its run, the dialog needs its controls , etc. refreshed and update...
will have finish its work!
Originally Posted by VictorN
Define " more deterministic".
The thread operation itself knows nothing about any "not quite sync with operation in the library". It's up to you how to "synchronize" these two operations.
Then just do it!
Victor Nijegorodov
-
March 15th, 2022, 02:16 AM
#7
Re: refresh dialog
Originally Posted by @EE@
Have a function as part of a dialog class which has some loops and so on and works. But during its run, the dialog needs its controls , etc. refreshed and update. For reasons can not use worker thread for this function. What's the best way to refresh/update dialog at the same time that the serial processes in this function are running. Without flickering .
There exists a "simple" way to implement it without using a worker thread. Just have a look at http://www.flounder.com/workerthreads.htm, section "Doing it the obsolete, and hard, way". But I'm afraid it will work slowly and won't avoid flickering.
Therefore, just read this essay further beginning with the section "The Thread Solution".
Victor Nijegorodov
-
March 16th, 2022, 01:32 AM
#8
Re: refresh dialog
thanks for the link. useful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|