how to disable double click event on a button.
-
Hello, I want my button to be clicked only once and not twice. What to do. Thanks In Advance. Dhiraj
-
Hello, I want my button to be clicked only once and not twice. What to do. Thanks In Advance. Dhiraj
How about disabling the button after the first click?
-
How about disabling the button after the first click?
actually what i want is that the user can only fire single click event and not double click. That is my meaning of disabling actually the button is not disabled but double click should not do any thing. It should not change its state.
-
actually what i want is that the user can only fire single click event and not double click. That is my meaning of disabling actually the button is not disabled but double click should not do any thing. It should not change its state.
As far as i know -and please correct me anyone if i am wrong- if the user doubleclicks your button you will get a click event at first. So at the first click you won't be able to know if the user will doubleclick or just singleclick. To be more clear on this, when the user doubleclicks your button, you get 2 command messages from the button and you either want only one of these or if a doubleclick was done you don't want any command messages at all?
-
Hello, I want my button to be clicked only once and not twice. What to do. Thanks In Advance. Dhiraj
Just add both a single-click handler and a double-click handler to the button, and do nothing for a double click.
-
Just add both a single-click handler and a double-click handler to the button, and do nothing for a double click.
-
or simply call the single-click handler from the double-click handler
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
He said he wants it to do nothing on a double click.
-
He said he wants it to do nothing on a double click.
That is fine if that is what he wants. But I was thinking of the user who will start rapidly clicking the button only to find that every other click does not work as expected.
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
-
Hello, I want my button to be clicked only once and not twice. What to do. Thanks In Advance. Dhiraj
you can use Pretranslatemessage method BOOL ::PreTranslateMessage(MSG* pMsg) { switch (pMsg->message) { case WM_LBUTTONDBLCLK: pMsg->message = WM_LBUTTONDOWN; break; } return 0; } or u can map lbuttondblclk and then post a message of WM_LBUTTONDOWN(best for activex button controls)
-
actually what i want is that the user can only fire single click event and not double click. That is my meaning of disabling actually the button is not disabled but double click should not do any thing. It should not change its state.
u can use PreTranslateMessage(MSG* pMsg) like this BOOL [ur class name]::PreTranslateMessage(MSG* pMsg) { switch (pMsg->message) { case WM_LBUTTONDBLCLK: pMsg->message = WM_LBUTTONDOWN; break; } return 0; }
-
Hello, I want my button to be clicked only once and not twice. What to do. Thanks In Advance. Dhiraj
How about simply removing the double click style from the window's class?
BOOL YourButtonClass::PreCreateWindow(CREATESTRUCT &cs)
{
WNDCLASS wndClass = { 0 };GetClassInfo(NULL, cs.lpszClass, &wndClass);
wndClass.style &= ~CS_DBLCLKS;
wndClass.lpszClassName = _T("BUTTON-DBLCLKS");if (AfxRegisterClass(&wndClass))
{
cs.lpszClass = wndClass.lpszClassName;
}return __super::PreCreateWindow(cs);
}