mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-11 03:28:07 -05:00
Handle two UI misbehaviors
Hover tooltip thread was throwing exceptions (silently, cuz thread); program starts with empty box slots, hovering between them would never show -> can't hide a never-shown (no handle) form Fix quirk with stat ordering and visibility toggling
This commit is contained in:
@@ -615,6 +615,12 @@ private void SetStatOrder(StatEditorStatOrder order)
|
||||
if (order == StatOrder)
|
||||
return;
|
||||
|
||||
// https://stackoverflow.com/a/30219698
|
||||
// WinForms hack to create the handles and avoid Z-order changing on visibility toggle.
|
||||
// Otherwise, our stat ordering may be incorrect if we change it more than once.
|
||||
foreach (Control ctrl in FLP_Stats.Controls)
|
||||
_ = ctrl.Handle;
|
||||
|
||||
// In Generation 1, Special Defense and Special Attack are combined.
|
||||
// Additionally, Speed is shown before Special.
|
||||
const int baseIndex = 1;
|
||||
|
||||
@@ -68,6 +68,10 @@ public void Clear()
|
||||
var src = _source;
|
||||
Task.Run(async () =>
|
||||
{
|
||||
if (!Previewer.IsHandleCreated)
|
||||
return; // not shown ever
|
||||
|
||||
// Give a little bit of fade-out delay
|
||||
await Task.Delay(50, CancellationToken.None).ConfigureAwait(false);
|
||||
if (!src.IsCancellationRequested)
|
||||
Previewer.Invoke(Previewer.Hide);
|
||||
|
||||
Reference in New Issue
Block a user