1 Attachment(s)
[RESOLVED] Wheelmouse scroll MDI application child forms
Bushmobile or anyone who can help?
Bushmobile posted code in the codebank for setting up the wheelmouse to scroll withn an applcation.
Attached is a shell of an MDI application.
The wheelmouse scrolls beautifully in the first opened child form but then the application terminates itself and shuts down vb as soon as a new child form is opened which is preventing me from using it.
Can anyone give me a suggestion or a fix?
Re: Wheelmouse scroll MDI application child forms
Hi
try this in your project...
VB Code:
Private Sub MNUNew_Click()
'Dim fForm As Form1
'Set fForm = New Form1
If Form1.Visible = False Then
Form1.Show
End If
'or write a code to create a new form as Form1 already exists!!!
End Sub
Hope it helps...
Re: Wheelmouse scroll MDI application child forms
You might try searching PSC for Paul Caton's safe, self subclassing code.
Then place code in the Form_Activate subs of the Midi children to release the last form and hook the new one.
Re: Wheelmouse scroll MDI application child forms
Longwolf, I can't find the reference you talked about on planet source code. Or not quite sure what I'm was looking for but your post explained what I needed to do.
I needed to unhook the current form and hook the next one.
VB Code:
Private Sub MNUNew_Click()
Dim fForm As Form1
Set fForm = New Form1
Call WheelUnHook
fForm.Show
Call WheelHook(fForm)
End Sub
I've read that the code I'm using is slightly unstable as if you press stop on the project, the wheelmouse doesn't unhook and VB shuts down. As far as I understand it anyway.
The "safe" subclassing code may be the answer. If you can post a link that would be great but you've been helpful with what you posted already.
Thankyou both.
Re: Wheelmouse scroll MDI application child forms
OK, this is a bit irritating.
I just tried to open three forms. The first and third form scroll but the second one has decided to unhook.
Any suggestions on how I unhook a form when goes to the background and hook another on it's selection?
Re: Wheelmouse scroll MDI application child forms
I'd place the code in the Activate subs.
That way your scroll should work even when the user switches between open midi forms.
Here's a search I did for you at PSC
Re: Wheelmouse scroll MDI application child forms
i don't have VB on this comp but I've had a look at your code.
the module that you've posted doesn't allow several windows to be managed though the same WndProc - hence why things aren't working.
try using the module in the CodeBank thread, it should work just fine then (as long as you implement it correctly ;))
Re: Wheelmouse scroll MDI application child forms
Got it :)
I must have changed your code when I found this extra bit of code which handles the scroll.
VB Code:
Public Sub MouseWheel(ByVal MouseKeys As Long, ByVal Rotation As Long, ByVal Xpos As Long, ByVal Ypos As Long)
Dim NewValue As Long
On Error Resume Next
With VScroll1
If Rotation > 0 Then
NewValue = .Value - .LargeChange
If NewValue < .Min Then
NewValue = .Min
End If
Else
NewValue = .Value + .LargeChange
If NewValue > .Max Then
NewValue = .Max
End If
End If
.Value = NewValue
End With
End Sub
Thanks. It's one of a few last finishing touches.