|
-
Jul 6th, 2006, 03:12 PM
#1
Thread Starter
Addicted Member
Re: scroll MDI Container with mouse wheel???
 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:
Me.Visible = False
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.
-
Jul 6th, 2006, 03:44 PM
#2
Re: scroll MDI Container with mouse wheel???
 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:
With Me.ActiveForm
[B]If .Top >= 0 And .Height < Me.ScaleHeight Then Exit Sub[/B]
If Rotation > 0 Then
 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.
-
Jul 6th, 2006, 05:27 PM
#3
Thread Starter
Addicted Member
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.
 Originally Posted by bushmobile
add this line:
VB Code:
With Me.ActiveForm
[B]If .Top >= 0 And .Height < Me.ScaleHeight Then Exit Sub[/B]
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.
-
Jul 7th, 2006, 04:36 AM
#4
Re: scroll MDI Container with mouse wheel???
 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:
' In declarations
Private Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Long) As Long
' in the place where we want the refresh
LockWindowUpdate Me.hWnd
Me.Height = Me.Height + 15
Me.Height = Me.Height - 15
LockWindowUpdate False
Since we're changing the size of the window the entire desktop will be redrawn (the icons will flicker like crazy)
-
Jul 7th, 2006, 06:17 AM
#5
Thread Starter
Addicted Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|