Lua forms: Added a scrollbars argument for creating a textbox.

This commit is contained in:
pjgat09 2016-01-15 21:19:25 -05:00
parent d786292ccf
commit e4a4a9606c
1 changed files with 23 additions and 2 deletions

View File

@ -565,7 +565,7 @@ namespace BizHawk.Client.EmuHawk
[LuaMethodAttributes(
"textbox",
"Creates a textbox control on the given form. The caption property will be the initial value of the textbox (default is empty). Width and Height are option, if not specified they will be a default size of 100, 20. Type is an optional property to restrict the textbox input. The available options are HEX, SIGNED, and UNSIGNED. Passing it null or any other value will set it to no restriction. x, and y are the optional location parameters for the position of the textbox within the given form. The function returns the handle of the created textbox. If true, the multiline will enable the standard winform multi-line property. If true, the fixedWidth options will create a fixed width font"
"Creates a textbox control on the given form. The caption property will be the initial value of the textbox (default is empty). Width and Height are option, if not specified they will be a default size of 100, 20. Type is an optional property to restrict the textbox input. The available options are HEX, SIGNED, and UNSIGNED. Passing it null or any other value will set it to no restriction. x, and y are the optional location parameters for the position of the textbox within the given form. The function returns the handle of the created textbox. If true, the multiline will enable the standard winform multi-line property. If true, the fixedWidth options will create a fixed width font. Scrollbars is an optional property to specify which scrollbars to display. The available options are Vertical, Horizontal, Both, and None. Scrollbars are only shown on a multiline textbox"
)]
public int Textbox(
int formHandle,
@ -576,7 +576,8 @@ namespace BizHawk.Client.EmuHawk
int? x = null,
int? y = null,
bool multiline = false,
bool fixedWidth = false)
bool fixedWidth = false,
string scrollbars = null)
{
var form = GetForm(formHandle);
if (form == null)
@ -591,6 +592,26 @@ namespace BizHawk.Client.EmuHawk
}
textbox.Multiline = multiline;
if (scrollbars != null)
{
switch (scrollbars.ToUpper())
{
case "VERTICAL":
textbox.ScrollBars = ScrollBars.Vertical;
break;
case "HORIZONTAL":
textbox.ScrollBars = ScrollBars.Horizontal;
textbox.WordWrap = false;
break;
case "BOTH":
textbox.ScrollBars = ScrollBars.Both;
textbox.WordWrap = false;
break;
case "NONE":
textbox.ScrollBars = ScrollBars.None;
break;
}
}
SetText(textbox, caption);
if (x.HasValue && y.HasValue)