mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
Trigger combobox event for event work values if value is 0
Closes #3240 Initial value is zero, so the "changed" event doesn't trigger, leaving the first combo item selected. Co-Authored-By: CanoeHope <43196464+CanoeHope@users.noreply.github.com>
This commit is contained in:
parent
76df80719a
commit
4719ee7816
1 changed files with 6 additions and 3 deletions
|
@ -139,7 +139,8 @@ namespace PKHeX.WinForms
|
|||
|
||||
lbl.Click += (sender, e) => mtb.Value = 0;
|
||||
bool updating = false;
|
||||
mtb.ValueChanged += (o, args) =>
|
||||
mtb.ValueChanged += ChangeConstValue;
|
||||
void ChangeConstValue(object sender, EventArgs e)
|
||||
{
|
||||
if (updating)
|
||||
return;
|
||||
|
@ -154,16 +155,18 @@ namespace PKHeX.WinForms
|
|||
if (CB_Stats.SelectedIndex == entry.Index)
|
||||
MT_Stat.Text = ((int)mtb.Value).ToString();
|
||||
updating = false;
|
||||
};
|
||||
}
|
||||
cb.SelectedValueChanged += (o, args) =>
|
||||
{
|
||||
if (editing || updating)
|
||||
return;
|
||||
var value = WinFormsUtil.GetIndex(cb);
|
||||
mtb.Value = value is NamedEventConst.CustomMagicValue ? 0 : value;
|
||||
mtb.Value = value == NamedEventConst.CustomMagicValue ? 0 : value;
|
||||
};
|
||||
|
||||
mtb.Value = values[entry.Index];
|
||||
if (mtb.Value == 0)
|
||||
ChangeConstValue(this, EventArgs.Empty);
|
||||
|
||||
TLP_Const.Controls.Add(lbl, 0, i);
|
||||
TLP_Const.Controls.Add(cb, 1, i);
|
||||
|
|
Loading…
Reference in a new issue