Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Determine which direction a splitter is being moved

Posted on 2009-12-22
2
Medium Priority
?
602 Views
Last Modified: 2012-05-08
Hi,

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?

Thanks
0
Comment
Question by:Sheritlw
2 Comments
 
LVL 61

Assisted Solution

by:HainKurt
HainKurt earned 2000 total points
ID: 26110270
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

0
 

Accepted Solution

by:
Sheritlw earned 0 total points
ID: 26110439
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
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question