But I've been working on a way to let us have options on par with "normal" plugins. This came to head with a good link provided by hotTamale (script developer extraordinaire) here. It goes into great detail dealing with accessing C# options from Lua.
I'm getting tired so to cut it short I'll just leave you with what the new options code will (probably) look like:
- --[[Options
- --#code
- --load the assemblies
- luanet.load_assembly "System.Windows.Forms"
- luanet.load_assembly "System.Drawing"
- --assign the objects (#include controls can supplant this)
- Form = luanet.import_type "System.Windows.Forms.Form"
- Button = luanet.import_type "System.Windows.Forms.Button"
- TextBox = luanet.import_type "System.Windows.Forms.TextBox"
- Label = luanet.import_type "System.Windows.Forms.Label"
- Point = luanet.import_type "System.Drawing.Point"
- --create the objects
- frmDialog = Form()
- txtZip = TextBox()
- lblZip = Label()
- butClose = Button()
- butApply = Button()
- --controls
- lblZip.Text = "Zipcode: "
- lblZip.Location=Point(20,20)
- txtZip.Text = "90210"
- txtZip.Location=Point(50,20)
- txtZip.Width = 150
- butApply.Text = "Apply"
- butApply.Location=Point(250,180)
- --button click handler
- handler=butApply.MouseUp:Add(function(sender, data)
- --apply code here
- Log(txtZip.text)
- frmDialog:HideDialog()
- end)
- butClose.Text = "Close"
- butClose.Location=Point(280,180)
- --button click handler
- handler=butApply.MouseUp:Add(function(sender, data)
- --reset fields and hide window
- frmDialog:HideDialog()
- end)
- --form properties
- frmDialog.Text = "My Dialog Box"
- frmDialog.Width = 300;
- frmDialog.Height = 250;
- frmDialog.HelpButton = true
- frmDialog.MaximizeBox=false
- frmDialog.MinimizeBox=false
- --assign controls to our window
- frmDialog.Controls:Add(txtZip)
- frmDialog.Controls:Add(lblZip)
- frmDialog.Controls:Add(butClose)
- frmDialog.Controls:Add(butApply)
- frmDialog:ShowDialog()
- EndOptions]]--
No comments:
Post a Comment