CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Posts
    18

    Mouse double click not working for MDI view scrollbar

    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

    Code:
    // 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;
    Last edited by ovidiucucu; May 27th, 2006 at 08:06 AM. Reason: [CODE] tags added

  2. #2
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Mouse double click not working for MDI view scrollbar

    [ 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.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  3. #3
    Join Date
    Sep 2003
    Posts
    18

    Re: Mouse double click not working for MDI view scrollbar

    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

  4. #4

    Re: Mouse double click not working for MDI view scrollbar

    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.

    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.
    Last edited by JamesSchumacher; May 28th, 2006 at 07:10 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured