Results 1 to 35 of 35

Thread: [RESOLVED] scroll MDI Container with mouse wheel???

Hybrid View

  1. #1

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    Quote Originally Posted by bushmobile
    I've decided to post this here (rather than the codebank thread) so more people will see it and possibly come up with a solution to another problem that gets generated.

    It seems that as long as the ActiveControl isn't one which already responds to the mousewheel (textbox/combobox/etc.) then the WM_MOUSEWHEEL is sent to the MDIForm and we just have to do some simple subclassing and then we can move the child form accordingly.

    However - the MDIForm scrollbar won't change it's position relative to the movement of the form - and I can't, for the life of me, get it to refresh without resorting to resizing the whole MDIForm which is obvious to the user.

    Edit: Just incase you weren't aware - this code (since it uses subclassing) will crash the IDE and you'll lose any unsaved work if you press the Stop button - unload the form correctly and you'll have no trouble & remember to save!
    Hey bushmobile,

    I just tested out your code and it works!!! The vertical scrollbar DOES refresh, but only when you move your mouse outside the mdi form. Also, one thing I noticed is it scrolls the child even if it's smaller than the parent. What I mean is, even if there is no vertical scrollbar, it still scrolls the child, which is not necessary.

    I will take a look at the code and see what I can do with it. I will also try out the FreeWheel and/or MS Intellipoint app that westconn1 suggested. I would honestly rather install a small mouse driver to fix the problem rather than add some code that may or may not cause other conflicts with my application.

    Again i will test both ways and see which works better. Although I am not sure if westconn1 understands what I was looking for. I don't need to be able to scroll in the vb IDE. There is actually a fix from microsoft to fix the vb6 IDE scroll wheel problem here, which also suggests to install Intellipoint v4.12. But I will try intellipoint and freewheel to see if it works with scrolling an mdi parent and child form.

    EDIT:
    hahaha I figured out a SUPER ghetto way of refreshing the scrollbar. Actually it's stupid and pointless, but maybe it will get you thinking...
    Add this where your comments is:
    VB Code:
    1. Me.Visible = False
    2. Me.Visible = True

    Maybe its just a matter of setting a property of the mdi form which whill initiate a refresh.
    Last edited by adamm83; Jul 6th, 2006 at 03:25 PM.
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: scroll MDI Container with mouse wheel???

    Quote Originally Posted by adamm83
    Also, one thing I noticed is it scrolls the child even if it's smaller than the parent. What I mean is, even if there is no vertical scrollbar, it still scrolls the child, which is not necessary.
    add this line:
    VB Code:
    1. With Me.ActiveForm
    2.         [B]If .Top >= 0 And .Height < Me.ScaleHeight Then Exit Sub[/B]
    3.         If Rotation > 0 Then
    Quote Originally Posted by adamm83
    I will take a look at the code and see what I can do with it. I will also try out the FreeWheel and/or MS Intellipoint app that westconn1 suggested. I would honestly rather install a small mouse driver to fix the problem rather than add some code that may or may not cause other conflicts with my application.
    if you aim to distribute your app then this isn't really an option - if it's just for yourself then getting a new driver would be the easier thing to do.

  3. #3

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    ok so I tested out IntelliPoint and FreeWheel and neither of them accomplish what your code can do. Neither of them can scroll the mdi container.

    Quote Originally Posted by bushmobile
    add this line:
    VB Code:
    1. With Me.ActiveForm
    2.         [B]If .Top >= 0 And .Height < Me.ScaleHeight Then Exit Sub[/B]
    3.         If Rotation > 0 Then
    if you aim to distribute your app then this isn't really an option - if it's just for yourself then getting a new driver would be the easier thing to do.
    Thanks, that fixed the problem. Figured out the refresh yet? I'm sure there is some sort of API or code that will force refresh a form. I will see what else I can do to refresh.
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  4. #4
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: scroll MDI Container with mouse wheel???

    Quote Originally Posted by adamm83
    Figured out the refresh yet? I'm sure there is some sort of API or code that will force refresh a form. I will see what else I can do to refresh.
    I tried almost everything I could think of and nothing worked. this was the best I could come up with:
    VB Code:
    1. ' In declarations
    2. Private Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Long) As Long
    3.  
    4. ' in the place where we want the refresh
    5. LockWindowUpdate Me.hWnd
    6. Me.Height = Me.Height + 15
    7. Me.Height = Me.Height - 15
    8. LockWindowUpdate False
    Since we're changing the size of the window the entire desktop will be redrawn (the icons will flicker like crazy)

  5. #5

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    hmmm ... wierd. I tried that before, and it didn't work for me. I'll try it again. what does LockWindowUpdate do?

    EDIT:

    Ok I tried it out and it works!... I also tried removing the 2 LockWindowUpdate lines and it works as well.... without the icon flickering. So I'm not sure what LockWindowUpdate does, but it seems to work without it.
    Last edited by adamm83; Jul 7th, 2006 at 06:28 AM.
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

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