Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > can't force redraw of my frame

Reply
Thread Tools

can't force redraw of my frame

 
 
Maik Wiege
Guest
Posts: n/a
 
      01-19-2004
Hi!
I want to show a blinking text over my derived CMDIChildWnd-class. The
blinking is done by one view which is hold by my frame. I set up a timer and
write text to the parent frame, which works fine. But I can't get the text
away the next time the timer fires. Here is some code:

void MyView::OnTimer(UINT nIDEvent)
{
if (nIDEvent!=1) return;
showText = !showText;
// Call base class handler.
CView::OnTimer(nIDEvent);

CUserFrame* frame = (CUserFrame*)(this->GetParentFrame());
CRect clientRect;
frame->GetClientRect(&clientRect);

if (showText){
// display the text --------- THIS WORKS FINE
CFont font;
CDC* dc = frame->GetDC();
font.CreatePointFont (720, _T ("Arial"));
CFont* oldFond = dc->SelectObject (&font);;
dc->SetBkMode (TRANSPARENT);
dc->SetTextColor(RGB(255,100,0));
dc->DrawText(_T("blink"), clientRect, DT_SINGLELINE | DT_CENTER |
DT_VCENTER);
dc->SelectObject (oldFond);
frame->ReleaseDC(dc);
}else{
// remove the text -------------- DOESN'T WORK

// here are many things I tried, but without success
::InvalidateRect(frame->m_hWnd,0,TRUE);
::InvalidateRect(frame->m_hWnd,&clientRect,TRUE);
::UpdateWindow(frame->m_hWnd);
frame->UnlockWindowUpdate();
frame->Invalidate(true);
frame->UpdateWindow();
frame->RedrawWindow();
frame->my2View->UnlockWindowUpdate(); /* my2View is anoter
view that the frame holds (It has a static splitter)*/
frame->my2View->InvalidateRect(&clientRect);
frame->my2View->Invalidate(true);
frame->my2View->UpdateWindow();
frame->my2View->RedrawWindow();
AfxGetMainWnd()->RedrawWindow();

/* To be sure that the code is working corect I added a drawText
here,
which is displayed correctly above the first text and is under
the "blink" after the next timer event */
CDC* dc = frame->GetDC();
dc->DrawText(_T("hello..."), clientRect, DT_SINGLELINE | DT_CENTER |
DT_VCENTER);
frame->ReleaseDC(dc);
}
}

So the result of the above code is that "blink" is written on my window,
then "hello" is written above it, than "blink" again... but the other text
will never be deleted.
Anyone any ideas why this is so, why the window is not redrawn, so the
"blink" should disapear, becaus it is not in the frames OnPaint()?

Thanks for any help
Maik


 
Reply With Quote
 
 
 
 
Jonathan Turkanis
Guest
Posts: n/a
 
      01-19-2004
"Maik Wiege" <(E-Mail Removed)> wrote in message
news:bufq00$2ks$07$(E-Mail Removed)-online.com...
> Hi!
> I want to show a blinking text over my derived CMDIChildWnd-class.

The
> blinking is done by one view which is hold by my frame. I set up a

timer and
> write text to the parent frame, which works fine. But I can't get

the text
> away the next time the timer fires. Here is some code:
>


This is a very advanced subject. We cannot help you here. You should
post in a newsgroup devoted to blinking text.

Jonathan


 
Reply With Quote
 
 
 
 
Jorge Rivera
Guest
Posts: n/a
 
      01-23-2004
Jonathan Turkanis wrote:

> "Maik Wiege" <(E-Mail Removed)> wrote in message
> news:bufq00$2ks$07$(E-Mail Removed)-online.com...
>
>>Hi!
>>I want to show a blinking text over my derived CMDIChildWnd-class.

>
> The
>
>>blinking is done by one view which is hold by my frame. I set up a

>
> timer and
>
>>write text to the parent frame, which works fine. But I can't get

>
> the text
>
>>away the next time the timer fires. Here is some code:
>>

>
>
> This is a very advanced subject. We cannot help you here. You should
> post in a newsgroup devoted to blinking text.


Actually, we can't help you here because it is and MFC question.
Go to a VisualC newsgroup.



Jorge L.

>
> Jonathan
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nike air force one, air force 1, air force one low cut, air force one abdul_razak@indiatimes.com Digital Photography 2 12-31-2008 04:29 PM
force redraw of a row in jtable... 6e Java 0 08-04-2005 02:00 PM
force redraw of a row in jtable... 6e Java 0 08-04-2005 01:59 PM
How to force a Web XML control to redraw/repaint? ~~~ .NET Ed ~~~ ASP .Net Building Controls 0 03-19-2005 02:05 PM
Force an FX redraw ritchie@ipowerhouse.com Ruby 6 02-20-2005 01:14 AM



Advertisments