473,663 Members | 2,726 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_Split terMoved(ByVal sender As Object, ByVal e As
System.Windows. Forms.SplitterE ventArgs) Handles Splitter1.Split terMoved
Log("Moved", e.SplitX)
End Sub

Private Sub Splitter1_Split terMoving(ByVal sender As Object, ByVal e As
System.Windows. Forms.SplitterE ventArgs) Handles Splitter1.Split terMoving
Log("Moving", e.SplitX)
End Sub

Private Sub Log(ByVal eventName As String, ByVal num As Integer)
results.Text += eventName + ": " & num & System.Environm ent.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 1679
On Tue, 22 Nov 2005 14:04:41 -0500, Marina wrote:
Private Sub Splitter1_Split terMoved(ByVal sender As Object, ByVal e As
System.Windows. Forms.SplitterE ventArgs) Handles Splitter1.Split terMoved
Log("Moved", e.SplitX)
End Sub

Private Sub Splitter1_Split terMoving(ByVal sender As Object, ByVal e As
System.Windows. Forms.SplitterE ventArgs) Handles Splitter1.Split terMoving
Log("Moving", e.SplitX)
End Sub

Private Sub Log(ByVal eventName As String, ByVal num As Integer)
results.Text += eventName + ": " & num & System.Environm ent.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.goo glegroups.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
2861
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 a four-way-splitter control? Regards, Andre Loker
4
8095
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 Left, Panel on right of form w/ Dock set to Fill, Splitter between them set w/ Dock set to Left. Works as advertised. But... if I change to have two panels on the form one on the left with Dock set to Left, a panel on the right with Dock set to...
1
3463
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 individual control and still use a splitter?
20
6683
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 the usual places (gotdonet.com/ asp.net etc) but no luck. Cheers Rohit
5
2320
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 has a horizontal splitter, which the user can use to resize the panel when it is expanded. I would like to save the height of the panel when the user uses the splitter, so that when the panel is expanded via the button, it size will be...
3
978
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, 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.
2
1141
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 right) I get an "External component has thrown an exception" error when I let go of the mouse button. Here is the stack trace. at
1
6064
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) that portion of the form is reduced in size by about 90% (I want to shrink this area of the of the form). The splitter doesn't appear to have any methods for programmatic resizing, I tried changing it's width settings and the splitter moved...
3
4165
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 being painted as a band similar to that of Disk Defragmentor. Any ideas on how to disable a Splitter panel from being resized? I've locked the controls (it stops me from resizing it at design time); I've set SplitterFixedPanel = Panel1 ; and I've...
0
8436
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8858
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8771
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8548
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8634
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4182
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.