scrolling when mouse is in the outskirt of a window

This is a discussion on scrolling when mouse is in the outskirt of a window within the Windows Programming forums, part of the Platform Specific Boards category; hi I have a control with some dragable objects in it. When I drag the selected objects to the uotskirt ...

  1. #1
    btq
    btq is offline
    julie lexx... btq's Avatar
    Join Date
    Jun 2002
    Posts
    161

    scrolling when mouse is in the outskirt of a window

    hi
    I have a control with some dragable objects in it. When I drag
    the selected objects to the uotskirt of the control it should scroll
    in the apropriate direction. Now, I can't find a good way to do this
    without stopping the messagesystem. I'd rather not use a loop
    inside the windows procedure since then no additional
    messages in the app wouldn't get thru before after the scrolling
    (and there must be a simpler way than multithreading)..
    Right now this scrollingbehaviour resides within the
    WM_MOUSEMOVE message, but then I have to move the mouse
    all the time for it to happend. What I would like to do is
    something like:if (WM_LBUTTONDOWN and Cursor.x<WindowWidth-20) then scroll..

    any ideas on how this may be accomplished in a good way...cause my ways have all sucked!

    thanks a bunch
    /btq
    ...viewlexx - julie lexx

  2. #2
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    thats sounds like it would work, with a timer added in.
    if you just put a little code in the WM_LBUTTONDOWN capture like this:

    Code:
    case WM_LBUTTONDOWN:
        toggle=1;
        SetTimer(hwnd,ID_TIMER,200,NULL);
    and this as well:

    Code:
    case WM_LBUTTONUP:
        toggle=0;
    
    case WM_TIMER:
        if mouseposition correct
            scroll;
    hmm...... it should probably be along those lines...

    maybe, add a mousemove capture, which checks if the cursor is in the right spot, if the mouse button is pushed down (use the toggle variable), then set the timer. otherwise, kill the timer. that way you aren't flooded with timer messages. got it?
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  3. #3
    btq
    btq is offline
    julie lexx... btq's Avatar
    Join Date
    Jun 2002
    Posts
    161
    hey thanks!
    works like a charm

    /btq
    ...viewlexx - julie lexx

  4. #4
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    thats amazing, since i have never even worked with dragging before
    u couldn't send me the source could u? it sounds interesting
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  5. #5
    btq
    btq is offline
    julie lexx... btq's Avatar
    Join Date
    Jun 2002
    Posts
    161
    u couldn't send me the source could u? it sounds interesting
    sure, I'll try sending it in a couple of hours when I've fixed some stuff..
    you want the whole thing or just this part?


    /btq
    ...viewlexx - julie lexx

  6. #6
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    anything to do with dragging thanks. i have some recollection of using dragging with VB, but that was years ago, and a completely different ballpark. so yeah, just anything to do with dragging

    cheers
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 09:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 11:17 AM
  4. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 11:50 AM
  5. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01:34 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21