Re: OnIdle called only while mouse's moving
"Peppe" <bacia@melo.it> wrote in message news:op.s9afpmgsyc3jzv@desktop...
Hi
I need to update one class data and the view during the idle, I used this
method in the Cdoc:
void CMyAppDoc::OnIdle(){
theClass->Update();
POSITION pos = GetFirstViewPosition();
CView* pView = GetNextView(pos);
pView->Invalidate(true);
pView->UpdateWindow(); }
It works only when I move the mouse, what's wrong? Z_Z
You need to return a non-zero value, to have it called again.
OnIdle is called when the message queue is emptied. If you return a
non-zero value, it will process any pending messages, and then call your
OnIdle again. As soon as you have finished your idle processing, return a 0
(this will make it NOT call you until it processes another message - like a
mouse movement event).
void CMyAppDoc::OnIdle()
{
theClass->Update();
POSITION pos = GetFirstViewPosition();
CView* pView = GetNextView(pos);
pView->Invalidate(true);
pView->UpdateWindow();
return 1; // make sure the framework will call this function again
}
DanB