* UIEditForm: 修改一处Show引起的无法获取控件值的问题

This commit is contained in:
Sunny 2022-04-18 16:04:30 +08:00
parent 74a493a00f
commit 866af62b33
2 changed files with 17 additions and 9 deletions

View File

@ -21,6 +21,7 @@
* 2021-05-19: V3.0.3 * 2021-05-19: V3.0.3
* 2021-10-26: V3.0.8 ComboTreeView类型 * 2021-10-26: V3.0.8 ComboTreeView类型
* 2021-10-28: V3.0.8 ComboCheckedListBox类型 * 2021-10-28: V3.0.8 ComboCheckedListBox类型
* 2022-04-18: V3.1.5 Show引起的无法获取控件值的问题
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -294,31 +295,39 @@ namespace Sunny.UI
set => btnCancel.Enabled = value; set => btnCancel.Enabled = value;
} }
protected void btnOK_Click(object sender, EventArgs e) private void btnOK_Click(object sender, EventArgs e)
{ {
if (!CheckData()) if (!CheckData())
{ {
return; return;
} }
else
{
DialogResult = DialogResult.OK;
IsOK = true;
}
if (CheckedData != null) if (CheckedData != null)
{ {
if (!CheckedData.Invoke(this, new EditFormEventArgs(this))) if (!CheckedData.Invoke(this, new EditFormEventArgs(this)))
{ {
DialogResult = DialogResult.None;
IsOK = false;
return; return;
} }
else
{
DialogResult = DialogResult.OK;
IsOK = true;
}
} }
if (ButtonOkClick != null) if (ButtonOkClick != null)
{ {
DialogResult = DialogResult.None;
IsOK = false;
ButtonOkClick.Invoke(sender, e); ButtonOkClick.Invoke(sender, e);
} }
else
{
DialogResult = DialogResult.OK;
IsOK = true;
Close();
}
} }
private void btnCancel_Click(object sender, EventArgs e) private void btnCancel_Click(object sender, EventArgs e)

View File

@ -60,8 +60,7 @@ namespace Sunny.UI
protected override void DoEnter() protected override void DoEnter()
{ {
if (btnCancel.Focused || btnOK.Focused) return; if (btnCancel.Focused || btnOK.Focused) return;
btnOK.PerformClick();
btnOK_Click(null, null);
} }
private void UIInputForm_Shown(object sender, System.EventArgs e) private void UIInputForm_Shown(object sender, System.EventArgs e)