Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Update caption in a thread
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Update caption in a thread

 Post Reply Post Reply
Author
Message
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post Topic: Update caption in a thread
    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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.