LuaImplementation: Implemented forms.setproperty and forms.getproperty. Kinda buggy though.

This commit is contained in:
rolanmen1 2012-08-25 22:45:44 +00:00
parent 5486acbbbc
commit 7a9e5d856b
1 changed files with 53 additions and 2 deletions

View File

@ -1969,8 +1969,13 @@ namespace BizHawk.MultiClient
LuaTextBox textbox = new LuaTextBox();
SetText(textbox, caption);
SetLocation(textbox, X, Y);
SetSize(textbox, X, Y);
if(X != null && Y != null)
SetLocation(textbox, X, Y);
if (width != null & height != null)
SetSize(textbox, width, height);
if (boxtype != null)
{
switch (boxtype.ToString().ToUpper())
@ -2061,6 +2066,28 @@ namespace BizHawk.MultiClient
}
}
public void forms_setproperty(object handle, object property, object value)
{
IntPtr ptr = new IntPtr(LuaInt(handle));
foreach (LuaWinform form in LuaForms)
{
if (form.Handle == ptr)
{
form.GetType().GetProperty(property.ToString()).SetValue(form, value, null);
}
else
{
foreach (Control control in form.Controls)
{
if (control.Handle == ptr)
{
control.GetType().GetProperty(property.ToString()).SetValue(control, value, null);
}
}
}
}
}
public void forms_addclick(object handle, LuaFunction lua_event)
{
IntPtr ptr = new IntPtr(LuaInt(handle));
@ -2119,6 +2146,30 @@ namespace BizHawk.MultiClient
return "";
}
public string forms_getproperty(object handle, object property)
{
IntPtr ptr = new IntPtr(LuaInt(handle));
foreach (LuaWinform form in LuaForms)
{
if (form.Handle == ptr)
{
return form.GetType().GetProperty(property.ToString()).GetValue(form, null).ToString();
}
else
{
foreach (Control control in form.Controls)
{
if (control.Handle == ptr)
{
return control.GetType().GetProperty(property.ToString()).GetValue(control, null).ToString();
}
}
}
}
return "";
}
public LuaTable input_getmouse()
{
LuaTable buttons = lua.NewTable();