Home » U++ Library support » U++ MT-multithreading and servers » thread sample and overrideCursor
Re: thread sample and overrideCursor [message #29819 is a reply to message #29816] |
Fri, 19 November 2010 17:30 |
|
koldo wrote on Fri, 19 November 2010 14:48 | Hello Ratah
I am not expert in threads, but it seems you use gui inside your threads. It would be better to be in main program.
|
It's not a problem using GUI in threads, only that he have to provide synchronization using GuiLook, which he doesn't. But as you've said, is better to use GUI only in main thread.
Ratah, see next my modifications for GUI in main thread.
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class TestThread : public TopWindow
{
// ......
void CheckProg() {
if(progress < 30)
progress++;
else
{
// I stop progress bar here
// Inside the thread, so thr1 always run!!!!
stop = false;
OverrideCursor(ImgCrs);
UpdateRefresh();
}
}
void CheckCount() {
icounter++;
status.Set(IntStr(icounter));
}
// ....
};
void TestThread::thrCb()
{
for(;!stop;)
{
PostCallback(THISBACK(CheckProg));
Sleep(100);
}
}
void TestThread::thrPerso()
{
for(;!stop; )
{
PostCallback(THISBACK(CheckCount));
Sleep(100);
}
}
My cursor updates without moving it (Win7).
|
|
|
Goto Forum:
Current Time: Sat May 11 18:20:19 CEST 2024
Total time taken to generate the page: 0.03094 seconds
|