473,508 Members | 2,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Splitter events in 2.0

Hi,

It seems that I am seeing an inconsistency in the arguments that get passed
to the SplitterMoved vs. SplitterMoving events.

As in, the ones for the SplitterMoving are correct coordinates, and the ones
for SplitterMoving are not.

I have a panel with 2 controls in it and a splitter. I also have a textbox
to log all the values of the events.

I then have the following code to capture the event arguments:

Private Sub Splitter1_SplitterMoved(ByVal sender As Object, ByVal e As
System.Windows.Forms.SplitterEventArgs) Handles Splitter1.SplitterMoved
Log("Moved", e.SplitX)
End Sub

Private Sub Splitter1_SplitterMoving(ByVal sender As Object, ByVal e As
System.Windows.Forms.SplitterEventArgs) Handles Splitter1.SplitterMoving
Log("Moving", e.SplitX)
End Sub

Private Sub Log(ByVal eventName As String, ByVal num As Integer)
results.Text += eventName + ": " & num & System.Environment.NewLine
End Sub
The results I get by running this program and moving the splitter a bit are:

Moving: 76
Moving: 77
Moving: 78
Moving: 79
Moving: 80
Moving: 81
Moving: 82
Moved: 123
Notice that the Moving is being fired correctly for every pixel.

However, when Moved has fired, it thinks that the splitter is at 123. When
clearly it would be at 82, since that is the last time Moving was called.
But in any case, it would not be 41 pixels over.

What is up with this? Am I looking at this the wrong way and doing something
incorrectly? Or is this a bug?
Nov 23 '05 #1
4 1662
On Tue, 22 Nov 2005 14:04:41 -0500, Marina wrote:
Private Sub Splitter1_SplitterMoved(ByVal sender As Object, ByVal e As
System.Windows.Forms.SplitterEventArgs) Handles Splitter1.SplitterMoved
Log("Moved", e.SplitX)
End Sub

Private Sub Splitter1_SplitterMoving(ByVal sender As Object, ByVal e As
System.Windows.Forms.SplitterEventArgs) Handles Splitter1.SplitterMoving
Log("Moving", e.SplitX)
End Sub

Private Sub Log(ByVal eventName As String, ByVal num As Integer)
results.Text += eventName + ": " & num & System.Environment.NewLine
End Sub


It is very odd behavior. It appears that SplitX is always exactly 1.5x the
correct location.
The SplitContainer (which now replaces the Splitter control) doesn't have
this issue, so I would just avoid the Splitter component if that's an
option for you.

Cheers,
Jason
Nov 23 '05 #2
Marina wrote:
What is up with this? Am I looking at this the wrong way and doing something
incorrectly? Or is this a bug?


I was able to duplicate this behavior. When my splitter was at 0, the
Moved event also reported 0, but as I moved the splitter to the right,
the SplitX value shown in the Moved event was increasingly off. When I
got to 640 on the Moving event, the Moved event reported 940! I
suspect it is a calculation bug or rounding bug in the event code.

Nov 23 '05 #3
Marina wrote:
What is up with this? Am I looking at this the wrong way and doing something
incorrectly? Or is this a bug?


I did the same test with a SplitContainer and it seems to work
correctly. You might try that instead.

Nov 23 '05 #4
Thanks Chris. The other workaround is to keep track of the SplitX in the
Moving event, in the Moved just use whatever value was last set in Moving.

Just wanted to confirm this issue.

Thanks,
Marina

"Chris Dunaway" <du******@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Marina wrote:
What is up with this? Am I looking at this the wrong way and doing
something
incorrectly? Or is this a bug?


I did the same test with a SplitContainer and it seems to work
correctly. You might try that instead.

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2852
by: Andre Loker | last post by:
Hi! For my current application I'm looking for a four-way-(cross) splitter control (as often seen in 3D-editors). The .NET Splitter-class is (IIRC) only a two-way splitter. Does anyone know such...
4
8083
by: BBM | last post by:
I'm trying to set up a form with two panels divided by a Splitter control. I can make the Splitter work in the situations described in the documentation (Listbox or TreeView on left w/Dock set to...
1
3451
by: Chuck Bowling | last post by:
I have a couple of controls that I'd like to use a vertical splitter control with. My problem is that I want different heights for the controls. Is there any way to set the height of each...
20
6666
by: Rohit Sharma | last post by:
Hi, My app is ASP .NET VB web application. I want to add a splitter control on it ....much like the msdn library. I have a treeviw on the left side. How can I do it ? I have searched in all...
5
2311
by: Sam | last post by:
Hi, I have a panel docked to the bottom of my form. This panel can be expanded vertically by clicking on a button. When the user click on the button again, the panel is then collapsed. The panel...
3
966
by: Marina | last post by:
Hi, It seems that I am seeing an inconsistency in the arguments that get passed to the SplitterMoved vs. SplitterMoving events. As in, the ones for the SplitterMoving are correct coordinates,...
2
1133
by: sling blade | last post by:
I have a form with a one panel docked to the left and a splitter control docked to the panel. I have no code, events or any other controls on the form. When I adjust the splitter (drag it to the...
1
6030
by: JDeats | last post by:
I have a simple WinForm with a WinForms splitter down the middle. I would like to make it so when the user clicks on a button inside the left portion of the screen (the panel to the splitters left)...
3
4157
by: Jeffrey Walton | last post by:
Hi All, I have a horizontal Splitter, for which I would like the top panel to remain 20 pixels in height. I do this because I have a containter on it, and I overide the OnPaint method. It is...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7383
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3194
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.