Open HeuristicLab-Trac-Bot opened 8 years ago
Also noticed that. Loading a problem instance fires a lot of events ans it seems that the redrawing is much slower now.
It is definitely related to enabling / disabling user controls. We are using some tricks in the base class (PInvoke user32.dll). It might be related to that.
Yes, and I have no idea why this is not working anymore. I put a question on stackoverflow. Not that I expect a good answer, but at least it's documented that way.
r14533: proposed fix for slow enable/disable operations?
I looked into this and found that calling SuspendRedraw and ResumeRedraw in View.OnEnabledChanged() fixes some of my problems. I'm not 100% sure about the implications and why this happens.
I also observed the following issues which are probably related:
- slow updates when changing views (e.g. open the GA - TSP problem and switch between the Evaluator and SolutionCreator)
- flickering and very slow updates on resize operations of nested views (e.g. open GA - TSP problem and select Parameters -> Analyzer -> BestTSPSolutionAnalyzer and then resize the window)
I don't know if r14533 is really a good solution. The first control that finishes OnEnabledChanged calls Resume and thus all UI updates thereafter are not suspended anymore.
I don't know maybe introduce some counting for calls to Suspend and Resume in order to resume only on the outermost Supsend-Resume of a long call chain. Otherwise, you're resuming quite early already. But that presents its own problems.
I also experienced some issues and additional flickering with r14533.
As abeham noticed,
ResumeRepaint
may be called too early, which is the case in theContent
property of theContentView
.When setting a new Content repainting is suspended, but calling SetEnabledStateOfControls usually sets the Enabled property (e.g. the ViewHost) which resumes repaint before the actual resume at the end of the Content property.
This leads to the problem that the ActiveView in the ViewHost is not always correctly removed. For instance, in the Result tab of an algorithm, when selecting a result, then stopping/preparing the algorithm removes all the results but the details view of the last selected result is still shown.
Flickering is noticeable well when using an
ItemCollectionView
that displays a “slow” view in the details. For instance, a RegressionProblemData with a large dataset (e.g. Tower) with the dataset selected. Changing to a different parameter cause 3 distinct flickers.
SuspendRepaintRegion.patch
(9.0 KiB)I tried to use using dispose-regions to avoid multiple suspend-calls and "too-early" resumes.
Maybe we want to do this anyway, but I didn't want to commit it yet, therefore i added a patch (see above).
I like pfleck's approach on SuspendRepaintRegions. However I think we must take the view nesting into accountsomehow. Otherwise the embedded view resumes again while the parent is still suspended. Maybe always suspend/resume at the top level view?
Can we please consider this for HL 4.0?
Issue migrated from trac ticket # 2638
milestone: HeuristicLab 4.0 | component: MainForm.WindowsForms | priority: high
2016-07-15 13:20:09: @abeham created the issue