Determine which direction a splitter is being moved


I am developing a touchscreen windows vb 2008 app that has a horizontal splitcontainer on the mdi parent form.

In Pane2 I have a keyboard that can be hidden/shown by pressing a button OR a user can also show/hide the keyboard by dragging the splitter up/down.
I need to either show/or hide the keyboard as they are dragging the splitter.

I also thought of just resizing panel2 and not setting the keyboards visible property but  I need a way to expand/collapse panel2 when the user presses the touchscreen button.

How do I either determine the direction the splitter is being moved OR How do I get the correct distance in order to expand/collapse panel2?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HainKurtSr. System AnalystCommented:
when splitter changes value, assign the value to a var and compare it

if (oldval > splitter.value) then --> moving up
if (oldval < splitter.value) then --> moving down
oldval = splitter.value

SheritlwAuthor Commented:
Hi HainKurt:

I adjusted your comment a little and now have my splitter working without having to hide/show the keyboard.
It's not as fine tuned as I would like it to be, but it works
In the forms SizeChanged event I set the variables
Private Sub frmMain_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
        miSplitValue = Me.Split1.Height / 3
        miSplitValue = miSplitValue + (miSplitValue / 2)
        Me.Split1.SplitterDistance = miSplitValue
        miButtHeight = Me.cmdKeyboard.Height + (Me.cmdKeyboard.Height / 6)
    End Sub

In my button click event

Private Sub cmdKeyboard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdKeyboard.Click
        Dim p As Integer = Me.Split1.SplitterDistance
        Dim s As Integer = Me.Split1.Panel1.Height + Me.Split1.Panel2.Height

        If p = miSplitValue Then
            Me.Split1.SplitterDistance = s - miButtHeight
        ElseIf p < miSplitValue Then
            Me.Split1.SplitterDistance = s - miButtHeight
        ElseIf p > miSplitValue Then
            Me.Split1.SplitterDistance = miSplitValue
        End If

    End Sub

Thank you for your help

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.