Print Page | Close Window

Update caption in a thread

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2691
Printed Date: 05 July 2025 at 9:13am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Update caption in a thread
Posted By: jeffcmj
Subject: Update caption in a thread
Date Posted: 06 August 2005 at 2:44am

Hi,

I tried to call CXTPControlButton::SetCaption from a thread other than the main UI thread. It works. But I find the button does not paint itself until I force it repaint, eg min/max it. Any suggestion?

Best

Jeff




Replies:
Posted By: Oleg
Date Posted: 07 August 2005 at 1:20am

What version do you have?

try to call

pControl->DelayLayoutParent or pControl->GetParent()->OnRecalcLayout();



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jeffcmj
Date Posted: 07 August 2005 at 10:11am

I am using 9.7 . Adding DelayLayoutParent() does not help.

This is how my program works. I have the MainFrame and View, in the view, I upgrade some XTP control's caption. At first they are all in the same thread and no program with it. In a later version, I change the view to run in a new thread, still updating the XTP control in the view, then I got the problem, the control won't update until I force the mainframe to redraw.



Posted By: jeffcmj
Date Posted: 07 August 2005 at 10:14am

Calling pControl->GetParent()->OnRecalcLayout(); solved my problem. Do I have to do it whenever I update the control in a thread or you could fix this in a future version?

Best

Jeff



Posted By: jeffcmj
Date Posted: 07 August 2005 at 10:22am

I found another problem. It seems when my mouse is inside the UI of my View( in a separate thread than mainfram), the mainframe control's OnUpdateUI handler is not called. Only when the mouse move over some part of the mainframe, the handler is called and the control is updated.



Posted By: jeffcmj
Date Posted: 07 August 2005 at 9:38pm
Another finding, clicking on anywhere in the View(in new thread) does not dismiss the popup bar in mainframe, eg, the menu, the toolbar dropdown, etc.


Posted By: Oleg
Date Posted: 08 August 2005 at 4:13am

These all problems because Frame and View must be in same thread. Try to remake it.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jeffcmj
Date Posted: 08 August 2005 at 8:40am
But I need to run the UI part of the view in another thread. Do you mean it can not be solved?


Posted By: jeffcmj
Date Posted: 10 August 2005 at 8:50pm

I finally get workaround of this problem.

In the view's thread's OnIdle handler, I post a message to the main thread to ask the mainthread to call its OnIdle handler. Then everything works.

I don't know any side effect of this workaround. Any feedback is appreciated.



Posted By: Oleg
Date Posted: 12 August 2005 at 2:33pm

Hmm.

It must help with RecalcLayout problem, but

does it fix problem with closing popups clicking on anywhere in the View?



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jeffcmj
Date Posted: 12 August 2005 at 10:21pm

No. I added a mouse hook in the view thread and post another message to the frame's thread in OnLbuttonDown and OnRbuttonDown. In the mainframe's handler I call SendTrackLost() .

Please advise if you think my solution will cause problem or you have better solutions.

Thanks




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net