Click to See Complete Forum and Search --> : Mouse double click not working for MDI view scrollbar


vinodpj
May 27th, 2006, 07:53 AM
I have an old MDI application created using SDK method.
Its main view is having scrollbar.

On double clicking on the vertical/horizontal scrollbar, I am able to receive only one click. (Second click is missing. )
That is the vertical scrollbar is getting moved only once. I am not receiving the second mouse click . (ie OnVScrollbar() function is getting called only once.).

And in the MDIWindowProc() function I am handling WM_VSCROLL,WM_LBUTTONDOWN, WM_LBUTTONDBLCLK functions.

Can anyone you please tell me which other function should I subcribe for moving vertical scroll bar twice during mouse double click.


Code snippet used for creating the view is given below

// Register the MDI child class
wc.style = CS_DBLCLKS | CS_OWNDC;
wc.lpfnWndProc = MDIWndProc;
wc.hInstance = _hInst;
wc.cbClsExtra = 0;
wc.cbWndExtra = MDIWNDEXTRA;
wc.hbrBackground= (HBRUSH)(COLOR_WINDOW + 1);
// wc.hbrBackground= COLOR_APPWORKSPACE + 1;
wc.hIcon = LoadIcon(_hLib, ID(IDI_ICON1));;
wc.hCursor = NULL;
wc.lpszMenuName = NULL;
strcpy(szClass, _szPropertyName);
strcat(szClass, "MDI");
wc.lpszClassName= szClass;
if (!RegisterClass(&wc))
return FALSE;

ovidiucucu
May 27th, 2006, 08:18 AM
[ Redirected thread ]

Why do you want o handle double click for scrollbars?
IMO you don't need even WM_LBUTTONDOWN.

WM_VSCROLL and WM_HSCROLL are pretty enough to handle scrollbars.

vinodpj
May 27th, 2006, 11:24 AM
Hi,
Thanks for the reply. I have already handling WM_VSCROLL and WM_HSCROLL. But in my application Scrolbar doesnt take double click correctly. On double click, scroll bar moves only once . It is actually expected to move twice.

Any idea why this is happening?

Thanks
Vin

JamesSchumacher
May 28th, 2006, 07:05 PM
That's because when a 'double click' occurs, only one WM_LBUTTONDBLCLK message is sent. So, it is only being handled once.

To get both clicks, you will have to handle each click separately. :p

Handle WM_LBUTTONDOWN, standard scroll bars scroll on WM_LBUTTONDOWN (that is, they don't wait for the button to be released) and scroll again on the second WM_LBUTTONDOWN.