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;
|
lbl.Click += (sender, e) => mtb.Value = 0;
|
||||||
bool updating = false;
|
bool updating = false;
|
||||||
mtb.ValueChanged += (o, args) =>
|
mtb.ValueChanged += ChangeConstValue;
|
||||||
|
void ChangeConstValue(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (updating)
|
if (updating)
|
||||||
return;
|
return;
|
||||||
|
@ -154,16 +155,18 @@ namespace PKHeX.WinForms
|
||||||
if (CB_Stats.SelectedIndex == entry.Index)
|
if (CB_Stats.SelectedIndex == entry.Index)
|
||||||
MT_Stat.Text = ((int)mtb.Value).ToString();
|
MT_Stat.Text = ((int)mtb.Value).ToString();
|
||||||
updating = false;
|
updating = false;
|
||||||
};
|
}
|
||||||
cb.SelectedValueChanged += (o, args) =>
|
cb.SelectedValueChanged += (o, args) =>
|
||||||
{
|
{
|
||||||
if (editing || updating)
|
if (editing || updating)
|
||||||
return;
|
return;
|
||||||
var value = WinFormsUtil.GetIndex(cb);
|
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];
|
mtb.Value = values[entry.Index];
|
||||||
|
if (mtb.Value == 0)
|
||||||
|
ChangeConstValue(this, EventArgs.Empty);
|
||||||
|
|
||||||
TLP_Const.Controls.Add(lbl, 0, i);
|
TLP_Const.Controls.Add(lbl, 0, i);
|
||||||
TLP_Const.Controls.Add(cb, 1, i);
|
TLP_Const.Controls.Add(cb, 1, i);
|
||||||
|
|
Loading…
Reference in a new issue