![]() |
Update caption in a thread |
Post Reply ![]() |
Author | |
jeffcmj ![]() Groupie ![]() Joined: 28 October 2004 Status: Offline Points: 92 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
What version do you have? try to call pControl->DelayLayoutParent or pControl->GetParent()->OnRecalcLayout(); |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
jeffcmj ![]() Groupie ![]() Joined: 28 October 2004 Status: Offline Points: 92 |
![]() ![]() ![]() ![]() ![]() |
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. |
|
![]() |
|
jeffcmj ![]() Groupie ![]() Joined: 28 October 2004 Status: Offline Points: 92 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
jeffcmj ![]() Groupie ![]() Joined: 28 October 2004 Status: Offline Points: 92 |
![]() ![]() ![]() ![]() ![]() |
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. |
|
![]() |
|
jeffcmj ![]() Groupie ![]() Joined: 28 October 2004 Status: Offline Points: 92 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
These all problems because Frame and View must be in same thread. Try to remake it. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
jeffcmj ![]() Groupie ![]() Joined: 28 October 2004 Status: Offline Points: 92 |
![]() ![]() ![]() ![]() ![]() |
But I need to run the UI part of the view in another thread. Do you mean it can not be solved?
|
|
![]() |
|
jeffcmj ![]() Groupie ![]() Joined: 28 October 2004 Status: Offline Points: 92 |
![]() ![]() ![]() ![]() ![]() |
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. |
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
jeffcmj ![]() Groupie ![]() Joined: 28 October 2004 Status: Offline Points: 92 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |