From 7a9e5d856bdbf625a1a980f4100148642666873a Mon Sep 17 00:00:00 2001 From: rolanmen1 Date: Sat, 25 Aug 2012 22:45:44 +0000 Subject: [PATCH] LuaImplementation: Implemented forms.setproperty and forms.getproperty. Kinda buggy though. --- BizHawk.MultiClient/LuaImplementation.cs | 55 +++++++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/BizHawk.MultiClient/LuaImplementation.cs b/BizHawk.MultiClient/LuaImplementation.cs index b7f97a56b0..4045d10be0 100644 --- a/BizHawk.MultiClient/LuaImplementation.cs +++ b/BizHawk.MultiClient/LuaImplementation.cs @@ -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();