issue #469 - lua - forms.newform() - add an onclosed callback optional parameter
This commit is contained in:
parent
5173541730
commit
64126fbad3
|
@ -381,7 +381,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
"newform",
|
||||
"creates a new default dialog, if both width and height are specified it will create a dialog of the specified size. If title is specified it will be the caption of the dialog, else the dialog caption will be 'Lua Dialog'. The function will return an int representing the handle of the dialog created."
|
||||
)]
|
||||
public int NewForm(int? width = null, int? height = null, string title = null)
|
||||
public int NewForm(int? width = null, int? height = null, string title = null, LuaFunction onClose = null)
|
||||
{
|
||||
var form = new LuaWinform();
|
||||
_luaForms.Add(form);
|
||||
|
@ -391,10 +391,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
form.Text = title;
|
||||
form.MaximizeBox = false;
|
||||
form.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||
form.Icon = SystemIcons.Application;
|
||||
form.MaximizeBox = false;
|
||||
form.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||
form.Icon = SystemIcons.Application;
|
||||
form.Show();
|
||||
|
||||
form.FormClosed += (o, e) =>
|
||||
{
|
||||
if (onClose != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
onClose.Call();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log(ex.ToString());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (int)form.Handle;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue