Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with SplitContainer - cannot move splitter after first movement (Winform) #23

Closed
bukkideme opened this issue Jun 21, 2019 · 3 comments

Comments

@bukkideme
Copy link
Contributor

bukkideme commented Jun 21, 2019

How to reproduce the issue:

  1. open a Winform project in Visual Studio (i used v2019)
  2. Drop a vertical SplitContainer into the Form.
  3. Drop a "scottPlotUC" control into the right Panel.
  4. Set Dock property to Fill for this plot control.
  5. Compile and run the project.

Discover the following: when you drag and move the splitter bar, it moves as expected. However, only once! The next attempt fails. The only way to make the vertical splitter movable again, is to resize the whole Form window, by changing its width or height by the mouse. After such Window resize, you can again move the splitter. But only once!
What causes this behaviour? If I drop the simple MS Chart into the right Panel of the SplitContainer, it behaves as expected.
Thanks if you can fix this, and also thanks for the very useful package!
SiC_VQ_data_analyzer.zip

@swharden
Copy link
Member

@bukkideme thanks for bringing this to my attention!
This bug is now fixed in ScottPlot 3.0.4 (available on NuGet)

Recreating this bug (without ScottPlot)

The fundamental problem seems to be that calling Application.DoEvents() on SplitterMoved (or a child's SizeChanged event) causes the split to freeze. Interestingly resizing the form unfreezes the splitter.

  1. create a new Winform project
  2. drop a SplitContainer on the form
  3. add Application.DoEvents() to the SplitContainer's SplitterMoved event
  4. resize a bunch of times and eventually the split will freeze
  5. once frozen, resizing the form unfreezes it

The Fix

The ScottPlot user control's SizeChanged event calls Render() which was calling Application.DoEvents(). I removed that call (5e485a9) and the program seems to be working well without it and the SplitContainer bug is gone.

@swharden
Copy link
Member

... just realized the Application.DoEvents() is required for smooth left-click-drag scrolling. I'll be putting that line back in, but only calling it if the user is actively panning/zooming. This will prevent it from being called when resizing a SplitContainer

@swharden swharden reopened this Jun 24, 2019
@swharden
Copy link
Member

Fixed: 4bc377c
I'll push an update to NuGet in the next hour or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants