Re: recurring mouse click messages
I don't get it you mean something like this?
SetTimer(IDT_TIMER,200,NULL);
void CMyWnd::OnTimer(UINT nID)
{
if (nID == IDT_TIMER)
{
PressButton();
SetTimer(IDT_TIMER,0,NULL);
}
}
One isn't that a little ambiguous? and Two why keep setting a new timer.
I think this is much easier to read, and probably a little faster.
void CMyWnd::OnTimer(UINT nID)
{
if (nID == IDT_DELAY)
{
KillTimer(IDT_DELAY);
SetTimer(IDT_PRESS,0,NULL);
}
else if (nID == IDT_PRESS)
{
PressButton();
}
}
AliR.
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:pb0ok4tkr9lhi85981jsn7cq79f73o0d3h@4ax.com...
You only need one timer. You do a SetTimer(IDT_TIMER, delay, NULL). When
the timer fires
the first time, you then do SetTimer(IDT_TIMER, repeat, NULL). You only
need a single
BOOL to tell you if you are initial delay or repeat state.
joe
On Fri, 19 Dec 2008 12:59:35 -0600, "asellon" <asellon@cox.net> wrote:
I stated I am using a window. I have a view, a doc and all the normal
things MFC programs have.
Except CWnd derived controls.
So buttons and other things that the user interacts with inside the
confines
of the window are created by me.
That being said, the solution I have selected is this.
Two timers in the view. The first timer is used to implement a delay, so
that once you click the button, it does not automatically begin the repeat
clicking process. When the first timer fires, it kills itself and starts
the second timer IF the button is still pressed. The second timer fires
repeatedly until the user releases the button. The mouseup handler kills
both timers regardless of the situation.
that pretty much sums it up.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm