U++ framework
Do not panic. Ask here before giving up.

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 Go to previous messageGo to previous message
Anonymous
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).
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Httpclient timeout
Next Topic: OpenMP
Goto Forum:
  


Current Time: Sun Sep 13 23:57:51 GMT+2 2026

Total time taken to generate the page: 0.00506 seconds