Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » How to redraw WindowText in time Collapse All
Subject Author Date
Jia Hong Li Mar 24, 2007 - 1:46 AM

I write a testing code in a sample.
I write two functions driven by two botton.
When I click, WindowText didn’t renew in time. Instead of that, I have to do some events(r-click and l-click, etc... ) in MenuBar or ToolBar, and then WindowText will be renew.

PS: WindowText: http://picasaweb.google.com.tw/ooy.yoo/Others/photo#5045391196717819074

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CMainFrame::OnTest1()
{ AfxGetMainWnd() -> SetWindowText (_T("test1")); }

void CMainFrame::OnTest2()
{ AfxGetMainWnd() -> SetWindowText (_T("test2")); }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

I had tried something else:
AfxGetMainWnd() -> SetWindowText (_T("test1"));
Invalidate();
But not useful

How could I do ??

Suhai Gyorgy Mar 24, 2007 - 6:41 AM

You should also call UpdateWindow() after Invalidate().

CWnd *pWnd = AfxGetMainWnd();
ASSERT(pWnd != NULL);
pWnd->SetWindowText(_T("test1"));
pWnd->Invalidate();
pWnd->UpdateWindow();

Jia Hong Li Mar 24, 2007 - 10:50 AM

the same, not useful

Technical Support Mar 24, 2007 - 1:45 PM

The window caption is part of the window’s non-client area. So you should invoke pWnd->SendMessage( WM_NCPAINT ); to redraw its caption.



Jia Hong Li Mar 25, 2007 - 4:38 AM

This is what I need, thank you very much