├── .vscode └── settings.json ├── Custom UI Elements ├── Pt 1 Examples.lua ├── Pt 2 Copy File.lua ├── Pt 2 Example.lua ├── Pt 2 Example 2.lua └── Pt 3 Example.lua ├── Lua for GrandMA3 ├── Ep 1 - Functions and Data Types.lua ├── Ep 4 - Building Tables in Lua.lua ├── Ep 3 - Command Line Interaction.lua ├── Ep 9 - Handle-ing MA3 Objects.lua ├── Ep 10 - Miscellaneous Important Info.lua ├── Ep 6 - Generic For Loop.lua ├── Ep 2 - If Statements and Value Comparison.lua ├── Ep 8 - Conditional Loops.lua ├── Ep 7 - Numeric For Loops.lua └── Ep 5 - UI Elements and MessageBox.lua ├── Miscellaneous ├── Reminder Plugins │ ├── Display Reminder.lua │ ├── Set Reminder.lua │ ├── Display Reminder 2.0.lua │ └── Set Reminder 2.0.lua ├── Table Example Info.lua └── Complete MessageBox.lua └── README.md /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "grandMa3.apiVersion": "2.2", 3 | "Lua.workspace.library": [ 4 | "c:\\Users\\From Dark To Light\\.vscode\\extensions\\carrot-industries.ma3-lua-api-1.3.4\\resources\\2.2" 5 | ], 6 | "Lua.diagnostics.disable": [ 7 | "undefined-field" 8 | ] 9 | } -------------------------------------------------------------------------------- /Custom UI Elements/Pt 1 Examples.lua: -------------------------------------------------------------------------------- 1 | function Example() 2 | local key, value = PopupInput({ 3 | title = 'an option', 4 | caller = GetFocusDisplay(), 5 | items = {'Option 1', 'Option 2'} 6 | }) 7 | 8 | local userInput = TextInput('this text box', 'Some default text') 9 | end 10 | return Example -------------------------------------------------------------------------------- /Lua for GrandMA3/Ep 1 - Functions and Data Types.lua: -------------------------------------------------------------------------------- 1 | function main() 2 | string = 'Hello World' 3 | number = 1.310 4 | string2 = '1.310' 5 | boolean = false 6 | myVar = nil 7 | 8 | Printf(string) 9 | 10 | function Print(myString) 11 | Printf(myString) 12 | end 13 | 14 | Print('Words') 15 | 16 | Confirm('Title', 'Hello! This is my text') 17 | end 18 | return main -------------------------------------------------------------------------------- /Lua for GrandMA3/Ep 4 - Building Tables in Lua.lua: -------------------------------------------------------------------------------- 1 | function main() 2 | myTable = {a = 1} 3 | 4 | myTable['b'] = 2 5 | myTable.c = 3 6 | 7 | MyNewTable = {10, 20, 25} 8 | table.insert(MyNewTable, 2, 'A value') 9 | 10 | MySequence = {name = 'Test', ID = 1} 11 | CmdIndirectWait('Store Sequence ' .. MySequence.ID .. ' /noconfirm; Label Sequence ' .. MySequence.ID .. ' "' .. MySequence.name .. '"') 12 | end 13 | return main -------------------------------------------------------------------------------- /Miscellaneous/Reminder Plugins/Display Reminder.lua: -------------------------------------------------------------------------------- 1 | function DisplayReminder() 2 | if (ReminderText ~= nil) then 3 | local reminder = MessageBox({ 4 | title = 'Hey!', 5 | message = ReminderText, 6 | commands = {{name = 'Remind Me Again', value = 1}, {name = 'Ok, Got It!', value = 0}} 7 | }) 8 | 9 | if (reminder.result == 0) then 10 | ReminderText = nil 11 | end 12 | end 13 | end 14 | return DisplayReminder -------------------------------------------------------------------------------- /Lua for GrandMA3/Ep 3 - Command Line Interaction.lua: -------------------------------------------------------------------------------- 1 | function main() 2 | Cmd('Label Sequence 1 "Test"') 3 | CmdIndirect('Label Sequence 1 "Test 2"') 4 | CmdIndirectWait('') 5 | 6 | function ConfirmHaze() 7 | local UserOK = Confirm('Hey', 'It\'s time to run haze for rehearsal. OK to proceed?') 8 | if (UserOK) then 9 | CmdIndirectWait('Go+ Page 1.115') 10 | end 11 | end 12 | 13 | ConfirmHaze() 14 | end 15 | return main -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Hello Lighting People! Welcome to From Dark To Light Tutorials! 2 | This git repository exists to facilitate the YouTube channel From Dark To Light, where I provide you with quick, insightful tutorials so you will easily be able to learn everything you need to know about programming in Lua for GrandMA3! 3 | Soon you'll be creating processes you never knew could exist! 4 | You can find the channel here: https://www.youtube.com/@FromDarkToLightTutorials 5 | 6 | I'll see you in the next awesome video! 7 | -------------------------------------------------------------------------------- /Miscellaneous/Reminder Plugins/Set Reminder.lua: -------------------------------------------------------------------------------- 1 | function SetReminder() 2 | local reminder = MessageBox({ 3 | title = 'Set Your Reminder', 4 | inputs = {{name = 'Enter Reminder Text', vkPlugin = 'TextInput', maxTextLength = 1000}}, 5 | commands = {{name = 'Set Reminder', value = 1}, {name = 'Cancel', value = 0}} 6 | }) 7 | 8 | if (reminder.result == 1) then 9 | for name, value in pairs(reminder.inputs) do 10 | if (ReminderText == nil) then 11 | ReminderText = tostring(value) 12 | else 13 | ReminderText = ReminderText .. '\n' .. tostring(value) 14 | end 15 | end 16 | end 17 | end 18 | return SetReminder -------------------------------------------------------------------------------- /Lua for GrandMA3/Ep 9 - Handle-ing MA3 Objects.lua: -------------------------------------------------------------------------------- 1 | --Note: The number 13 for ShowData and DataPools has been changed to 14 in v2.2 2 | function Main() 3 | local mySequenceHandle = FromAddr("ShowData.DataPools.Default.Sequences.1") 4 | Printf(tostring(mySequenceHandle)) 5 | Printf(tostring(mySequenceHandle:Addr())) 6 | 7 | local Handle = ObjectList('Sequence 1 Cue 3')[1] 8 | if (IsObjectValid(Handle)) then 9 | Printf(Handle.name) 10 | end 11 | --Handle.name = 'Test' 12 | 13 | --[[Printf('----------Beginning of Dump-------------') 14 | Handle:Dump() -- I changed this after it was pointed out to me that Dump prints on its own, so my overlapping text in the cmd history was caused by 2 simultaneous prints. 15 | Printf('----------End of Dump-----------------')]] 16 | end 17 | return Main 18 | -------------------------------------------------------------------------------- /Lua for GrandMA3/Ep 10 - Miscellaneous Important Info.lua: -------------------------------------------------------------------------------- 1 | function Main(display, arg) 2 | --Printf(arg) 3 | 4 | a, b = string.find('This is my string', ' is') 5 | 6 | Args = {} 7 | local i = 0 8 | local lastArg = 1 9 | while true do 10 | x, i = string.find(arg, ', ', i + 1) 11 | if (i == nil) then 12 | table.insert(Args, string.sub(arg, lastArg, -1)) 13 | break 14 | else 15 | table.insert(Args, string.sub(arg, lastArg, x -1)) 16 | lastArg = i + 1 17 | end 18 | end 19 | 20 | function OurTime(UTC) 21 | if tonumber(UTC) < 5 then 22 | UTC = tonumber(UTC +24) 23 | end 24 | local realtime = UTC - 5 25 | return realtime 26 | end 27 | 28 | Printf(OurTime(os.date('%H'))) 29 | 30 | Echo('Hi') 31 | ErrEcho('Hello!') 32 | ErrPrintf('hi!') 33 | end 34 | return Main 35 | -------------------------------------------------------------------------------- /Lua for GrandMA3/Ep 6 - Generic For Loop.lua: -------------------------------------------------------------------------------- 1 | function main() 2 | myTable = {10, 20, 30, 40, 50} 3 | table.insert(myTable, 60) 4 | 5 | myInfo = {name = 'John Doe', age = 36, birthplace = 'United States'} 6 | 7 | for key, value in ipairs(myTable) do 8 | Printf('This is my value: ' .. value) 9 | end 10 | 11 | for key, value in pairs(myInfo) do 12 | Printf('Key: ' .. key .. ' Value: ' .. value) 13 | end 14 | 15 | local returnTable = MessageBox({ 16 | title = 'A Question for You', 17 | inputs = {{name = 'Input 1', value = '', vkPlugin = 'TextInput', maxTextLength = 100}, {name = 'Input 2', value = 'Something', vkPlugin = 'TextInput', maxTextLength = 100}, {name = 'Input 3', value = '3', vkPlugin = 'TextInput', maxTextLength = 100}}, 18 | commands = {{name = 'OK', value = 1}} 19 | }) 20 | 21 | for key, value in pairs(returnTable.inputs) do 22 | Printf(value) 23 | end 24 | 25 | end 26 | return main -------------------------------------------------------------------------------- /Lua for GrandMA3/Ep 2 - If Statements and Value Comparison.lua: -------------------------------------------------------------------------------- 1 | function main() 2 | --[[Make sure you set myVar before running this code or you will get an error. 3 | Once it has been set by running the code, deleting that code does not cause a problem until the system is reset. 4 | This is why it still worked in my video after I deleted that code.]] 5 | if (myVar == 35) then 6 | Printf('myVar is 35') 7 | elseif (myVar < 35) then 8 | Printf('myVar is less than 35') 9 | elseif (myVar > 35 and myVar < 40) then 10 | Printf('myVar is more than 35') 11 | else 12 | Printf('Number is too large') 13 | end 14 | 15 | local Answer = Confirm('Hey', 'Confirm me!') 16 | 17 | if (Answer) then 18 | Printf('User confirmed the pop-up.') 19 | elseif (Answer == false) then 20 | Printf('User canceled the pop-up.') 21 | end 22 | end 23 | return main -------------------------------------------------------------------------------- /Miscellaneous/Reminder Plugins/Display Reminder 2.0.lua: -------------------------------------------------------------------------------- 1 | function DisplayReminder(display, reminderArg) 2 | if (reminderArg == 'Post-Rehearsal') then 3 | CurrentReminder = PostRReminder 4 | PostRReminder = {} 5 | elseif(reminderArg == 'Post-Service') then 6 | CurrentReminder = PostSReminder 7 | PostSReminder = {} 8 | if (os.date('%A') == 'Sunday' and os.date('%X') < '11:00:00') then 9 | PostSReminder = PostS2Reminder 10 | else 11 | PostSReminder ={} 12 | end 13 | elseif(reminderArg == 'Regular') then 14 | CurrentReminder = NextReminder 15 | NextReminder = {} 16 | end 17 | 18 | for i, text in ipairs(CurrentReminder) do 19 | if (ReminderText == nil) then 20 | ReminderText = text 21 | else 22 | ReminderText = ReminderText .. '\n\n' .. text 23 | end 24 | end 25 | 26 | if (ReminderText ~= nil) then 27 | local reminder = MessageBox({ 28 | title = 'Hey!', 29 | message = ReminderText, 30 | commands = {{name = 'Remind Me Again', value = 1}, {name = 'Ok, Got It!', value = 0}} 31 | }) 32 | 33 | if (reminder.result ~= 0) then 34 | NextReminder = ReminderText 35 | end 36 | end 37 | end 38 | return DisplayReminder -------------------------------------------------------------------------------- /Lua for GrandMA3/Ep 8 - Conditional Loops.lua: -------------------------------------------------------------------------------- 1 | function main() 2 | MyNum = 0 3 | while (MyNum < 10) do 4 | Printf('MyNum is less than 10') 5 | MyNum = MyNum + 1 6 | end 7 | Printf('MyNum is 10 now!') 8 | 9 | MyNum = 0 10 | repeat 11 | MyNum = MyNum + 1 12 | if (MyNum == 2) then 13 | Printf('My Number is 2') 14 | else 15 | Printf('My number is not 2') 16 | end 17 | until MyNum > 2 18 | 19 | SongSetup = nil 20 | SequenceLocation = 1 21 | 22 | repeat 23 | if (IsObjectValid(FromAddr("Sequences." .. SequenceLocation, DataPool()))) then 24 | local question = MessageBox({ 25 | title = 'Hey', 26 | message = 'The location for your sequences to be copied to is currently occupied. Would you like to use the existing ones, delete them and put new ones in, or try a different location?', 27 | commands = {{value = 1, name = 'Delete them'}, {value = 2, name = 'Use them'}, {value = 3, name = 'Try a different location'}, {value = 4, name = 'Cancel setup'}} 28 | }) 29 | if question.result == 1 then 30 | CmdIndirectWait('Delete Sequence 1 thru 4') 31 | SongSetup = 'Approved' 32 | elseif question.result == 2 then 33 | SongSetup = 'Assignments Only' 34 | elseif question.result == 3 then 35 | SequenceLocation = SequenceLocation + 10 36 | else 37 | SongSetup = 'Cancelled' 38 | end 39 | else 40 | SongSetup = 'Approved' 41 | end 42 | until SongSetup ~= nil 43 | 44 | end 45 | return main -------------------------------------------------------------------------------- /Miscellaneous/Table Example Info.lua: -------------------------------------------------------------------------------- 1 | function TableExampleInfo() 2 | -- When you create a table, you can give the keys any value of any data type 3 | stringVariable = 'myString' -- This variable can be used to add to a table using brackets or a '.' but not in creating a table in braces 4 | myTable = {string = 1, otherString = 'My Table Value'} -- These blue keys are actually strings. You can't put them in parentheses here but must to call them using brackets 5 | 6 | myTable[stringVariable] = true -- The index for this value is 'myString' 7 | myTable.stringVariable = true -- This sytax is also valid and does the same thing 8 | myTable['myString'] = true -- So does this 9 | myTable.myString = true -- And this 10 | -- You can't use a string with spaces the last way 11 | 12 | myTable[5] = 'My index is 5' -- This creates a value at index 5. You can't do it using braces or a '.' 13 | 14 | -- You can add to a table using table.insert but you must create the table first and you can only specify a numeric index 15 | myNewTable = {1, 2} -- It can be empty or contain values to start with but you can't add a value at a specific index unless it already exists 16 | table.insert(myNewTable, 2, 'My index is 2') -- This inserts a value at index 2 and pushes the rest over one. They are now ordered, {1, 'My index is 2', 2} 17 | table.insert(myNewTable, 'Next empty index starting at 1') -- This one inserts a value at the next empty numeric index 18 | 19 | -- You can also insert a table in a table 20 | myTable['InnerTable'] = {'This is a value', 'Here is another one'} -- These table values are at index 1 and 2 21 | 22 | -- To retrieve table values, it is the same process. Here is a way to reference a table within a table 23 | myValue = myTable.InnerTable[1] 24 | alsoMyValue = myTable['InnerTable'][1] 25 | -- When you set a value to a table value it takes on that value, not a reference. In other words, if you delete or change myTable.InnerTable[1] now, myValue doesn't change 26 | 27 | end 28 | return TableExampleInfo -------------------------------------------------------------------------------- /Lua for GrandMA3/Ep 7 - Numeric For Loops.lua: -------------------------------------------------------------------------------- 1 | function main() 2 | for i = 1, 10, 2 do 3 | Printf('My number is ' .. i) 4 | end 5 | 6 | if (IsObjectValid(FromAddr('Sequences.Praise', DataPool()))) then 7 | mySongList = {'Praise'} 8 | for i = 1, 100 do -- This should have been 2, 100 so it would start with 2. 9 | if (IsObjectValid(FromAddr('Sequences.Praise#' .. i, DataPool()))) then 10 | table.insert(mySongList, 'Praise#' .. i) 11 | else 12 | break 13 | end 14 | end 15 | end 16 | 17 | PostWorshipSequences = {} 18 | SermonDefaults = {'Greet People', 'Video Announcements', 'Video Sermon', 'Live Pastor Up', 'Dismiss'} 19 | 20 | 21 | local ConfirmServiceFlow = MessageBox({ 22 | title = 'Confirm', 23 | message_align_h = Enums.AlignmentH.Left, 24 | message = 'Is this the right service flow for today?\n\t' .. SermonDefaults[1] .. '\n\t' .. SermonDefaults[2] .. '\n\t' .. SermonDefaults[3] .. '\n\t' .. SermonDefaults[4] .. '\n\t' .. SermonDefaults[5], 25 | commands = {{value = 1, name = 'Yes'}, {value = 0, name = 'No'}} 26 | }) 27 | 28 | if ConfirmServiceFlow.result == 1 then 29 | for i = 1, 5 do 30 | PostWorshipSequences[i] = SermonDefaults[i] 31 | end 32 | else 33 | local ManualSetup = MessageBox({ 34 | title = 'Set Up Post-Worship', 35 | message_align_h = Enums.AlignmentH.Left, 36 | message = 'These are the names of the sequences which can be used for service.\n\t' .. SermonDefaults[1] .. '\n\t' .. SermonDefaults[2] .. '\n\t' .. SermonDefaults[3] .. '\n\t' .. SermonDefaults[4] .. '\n\t' .. SermonDefaults[5] .. '\nPlease type the name of each element in the box for its place in the sevice flow.', 37 | commands = {{value = 1, name = 'Confirm'}}, 38 | inputs = {{name = 'Sequence 1', vkPlugin = 'TextInput', maxTextLength = 50}, {name = 'Sequence 2', vkPlugin = 'TextInput', maxTextLength = 50},{name = 'Sequence 3', vkPlugin = 'TextInput', maxTextLength = 50},{name = 'Sequence 4', vkPlugin = 'TextInput', maxTextLength = 50},{name = 'Sequence 5', vkPlugin = 'TextInput', maxTextLength = 50}} 39 | }) 40 | for name, value in pairs(ManualSetup.inputs) do 41 | if (value ~= nil) then 42 | for i = 1, 5 do 43 | if (name == 'Sequence ' .. i) then 44 | PostWorshipSequences[i] = tostring(value) 45 | end 46 | end 47 | end 48 | end 49 | end 50 | 51 | end 52 | return main -------------------------------------------------------------------------------- /Custom UI Elements/Pt 2 Copy File.lua: -------------------------------------------------------------------------------- 1 | local pluginName = select(1, ...) 2 | local componentName = select(2, ...) 3 | local signalTable = select(3, ...) 4 | local myHandle = select(4, ...) 5 | function Main() 6 | local baseInput = GetFocusDisplay().ScreenOverlay:Append('BaseInput') 7 | baseInput.Name = 'DMXTesterWindow' 8 | baseInput.H = 0 9 | baseInput.W = 600 10 | baseInput.Columns = 1 11 | baseInput.Rows = 2 12 | baseInput[1][1].SizePolicy = 'Fixed' 13 | baseInput[1][1].Size = 60 14 | baseInput[1][2].SizePolicy = 'Stretch' 15 | baseInput.AutoClose = 'No' 16 | baseInput.CloseOnEscape = 'Yes' 17 | 18 | local titleBar = baseInput:Append('TitleBar') 19 | titleBar.Columns = 2 20 | titleBar.Rows = 1 21 | titleBar.Anchors = '0,0' 22 | titleBar[2][2].SizePolicy = 'Fixed' 23 | titleBar[2][2].Size = 50 24 | titleBar.Texture = 'corner2' 25 | 26 | local titleBarIcon = titleBar:Append('TitleButton') 27 | titleBarIcon.Text = 'Dialog Example' 28 | titleBarIcon.Texture = 'corner1' 29 | titleBarIcon.Anchors = '0,0' 30 | titleBarIcon.Icon = 'star' 31 | 32 | local titleBarCloseButton = titleBar:Append('CloseButton') 33 | titleBarCloseButton.Anchors = '1,0' 34 | titleBarCloseButton.Texture = 'corner2' 35 | 36 | local dlgFrame = baseInput:Append('DialogFrame') 37 | dlgFrame.H = '100%' 38 | dlgFrame.W = '100%' 39 | dlgFrame.Columns = 1 40 | dlgFrame.Rows = 2 41 | dlgFrame.Anchors = '0,1' 42 | dlgFrame[1][1].SizePolicy = 'Fixed' 43 | dlgFrame[1][1].Size = 60 44 | dlgFrame[1][2].SizePolicy = 'Fixed' 45 | dlgFrame[1][2].Size = 60 46 | 47 | local subTitle = dlgFrame:Append('UIObject') 48 | subTitle.Text = 'This example contains a subtitle.' 49 | subTitle.ContentDriven = 'Yes' 50 | subTitle.ContentWidth = 'No' 51 | subTitle.TextAutoAdjust = 'Yes' 52 | subTitle.Anchors = '0, 0' 53 | subTitle.Padding = '20, 15' 54 | subTitle.Font = 'Medium20' 55 | subTitle.HasHover = 'No' 56 | subTitle.BackColor = Root().ColorTheme.ColorGroups.Global.Transparent 57 | 58 | local buttonGrid = dlgFrame:Append('UILayoutGrid') 59 | buttonGrid.Columns = 1 60 | buttonGrid.Rows = 1 61 | buttonGrid.Anchors = '0,1' 62 | 63 | local applyButton = buttonGrid:Append('Button') 64 | applyButton.Anchors = '0,0' 65 | applyButton.Textshadow = 1 66 | applyButton.HasHover = 'Yes' 67 | applyButton.Text = 'Apply' 68 | applyButton.Font = 'Medium20' 69 | applyButton.TextalignmentH = 'Centre' 70 | applyButton.PluginComponent = myHandle 71 | applyButton.Clicked = 'ButtonClicked' 72 | 73 | signalTable.ButtonClicked = function(caller) 74 | GetFocusDisplay().ScreenOverlay:ClearUIChildren() 75 | end 76 | end 77 | return Main -------------------------------------------------------------------------------- /Custom UI Elements/Pt 2 Example.lua: -------------------------------------------------------------------------------- 1 | local pluginName = select(1, ...) 2 | local componentName = select(2, ...) 3 | local signalTable = select(3, ...) 4 | local myHandle = select(4, ...) 5 | function main() 6 | local baseInput = GetFocusDisplay().ScreenOverlay:Append('BaseInput') 7 | baseInput.Name = 'DMXTesterWindow' 8 | baseInput.H = 0 9 | baseInput.W = 600 10 | baseInput.Columns = 1 11 | baseInput.Rows = 2 12 | baseInput[1][1].SizePolicy = 'Fixed' 13 | baseInput[1][1].Size = 60 14 | baseInput[1][2].SizePolicy = 'Stretch' 15 | baseInput.AutoClose = 'No' 16 | baseInput.CloseOnEscape = 'Yes' 17 | 18 | local titleBar = baseInput:Append('TitleBar') 19 | titleBar.Columns = 2 20 | titleBar.Rows = 1 21 | titleBar.Anchors = '0,0' 22 | titleBar[2][2].SizePolicy = 'Fixed' 23 | titleBar[2][2].Size = 50 24 | titleBar.Texture = 'corner2' 25 | 26 | local titleBarIcon = titleBar:Append('TitleButton') 27 | titleBarIcon.Text = 'Dialog Example' 28 | titleBarIcon.Texture = 'corner1' 29 | titleBarIcon.Anchors = '0,0' 30 | titleBarIcon.Icon = 'star' 31 | 32 | local titleBarCloseButton = titleBar:Append('CloseButton') 33 | titleBarCloseButton.Anchors = '1,0' 34 | titleBarCloseButton.Texture = 'corner2' 35 | 36 | local dlgFrame = baseInput:Append('DialogFrame') 37 | dlgFrame.H = '100%' 38 | dlgFrame.W = '100%' 39 | dlgFrame.Columns = 1 40 | dlgFrame.Rows = 2 41 | dlgFrame.Anchors = '0,1' 42 | dlgFrame[1][1].SizePolicy = 'Fixed' 43 | dlgFrame[1][1].Size = 60 44 | dlgFrame[1][2].SizePolicy = 'Fixed' 45 | dlgFrame[1][2].Size = 60 46 | 47 | local subTitle = dlgFrame:Append('UIObject') 48 | subTitle.Text = 'This example contains a subtitle.' 49 | subTitle.ContentDriven = 'Yes' 50 | subTitle.ContentWidth = 'No' 51 | subTitle.TextAutoAdjust = 'Yes' 52 | subTitle.Anchors = '0, 0' 53 | subTitle.Padding = '20, 15' 54 | subTitle.Font = 'Medium20' 55 | subTitle.HasHover = 'No' 56 | subTitle.BackColor = Root().ColorTheme.ColorGroups.Global.Transparent 57 | 58 | local buttonGrid = dlgFrame:Append('UILayoutGrid') 59 | buttonGrid.Columns = 1 60 | buttonGrid.Rows = 1 61 | buttonGrid.Anchors = '0,1' 62 | 63 | local applyButton = buttonGrid:Append('Button') 64 | applyButton.Anchors = '0,0' 65 | applyButton.Textshadow = 1 66 | applyButton.HasHover = 'Yes' 67 | applyButton.Text = 'Apply' 68 | applyButton.Font = 'Medium20' 69 | applyButton.TextalignmentH = 'Centre' 70 | applyButton.PluginComponent = myHandle 71 | applyButton.Clicked = 'ButtonClicked' 72 | 73 | signalTable.ButtonClicked = function(caller) 74 | GetFocusDisplay().ScreenOverlay:ClearUIChildren() 75 | end 76 | end 77 | return main -------------------------------------------------------------------------------- /Miscellaneous/Reminder Plugins/Set Reminder 2.0.lua: -------------------------------------------------------------------------------- 1 | function SetReminder() 2 | NoService = {{value = 1, name = 'Remind Me Soon'}, {value = 10, name = 'Cancel'}} 3 | Rehearsal = {{value = 1, name = 'Remind Me Soon'}, {value = 2, name = 'Remind Me After Rehearsal'}, {value = 3, name = 'Remind Me After Service'}, {value = 10, name = 'Cancel'}} 4 | SundayRehearsal = {{value = 1, name = 'Remind Me Soon'}, {value = 2, name = 'Remind Me After Rehearsal'}, {value = 3, name = 'Remind Me After Service'}, {value = 4, name = 'Remind Me After 2nd Service'}, {value = 10, name = 'Cancel'}} 5 | Sunday9 = {{value = 1, name = 'Remind Me Soon'},{value = 3, name = 'Remind Me After Service'}, {value = 4, name = 'Remind Me After 2nd Service'}, {value = 10, name = 'Cancel'}} 6 | Service = {{value = 1, name = 'Remind Me Soon'},{value = 3, name = 'Remind Me After Service'}, {value = 10, name = 'Cancel'}} 7 | if not (TablesSet) then 8 | NextReminder = {} 9 | PostRReminder = {} 10 | PostSReminder = {} 11 | PostS2Reminder = {} 12 | TablesSet = true 13 | end 14 | if (os.date('%A') == 'Sunday' and os.date('%X') > '10:20:00' and not ChangeOver) then 15 | PostSReminder = PostS2Reminder 16 | PostS2Reminder = {} 17 | ChangeOver = true 18 | end 19 | 20 | if (os.date('%A') == 'Sunday') then 21 | if (os.date('%X') < '07:55:00') then 22 | CommandTable = SundayRehearsal 23 | elseif (os.date('%X') < '10:20:00') then 24 | CommandTable = Sunday9 25 | elseif (os.date('%X') < '12:20:00') then 26 | CommandTable = Service 27 | else 28 | CommandTable = NoService 29 | end 30 | elseif (os.date('%A') == 'Wednesday') then 31 | if (os.date('%X') < '18:00:00') then 32 | CommandTable = Rehearsal 33 | elseif(os.date('%X') < '20:00:00') then 34 | CommandTable = Service 35 | else 36 | CommandTable = NoService 37 | end 38 | else 39 | CommandTable = NoService 40 | end 41 | local reminder = MessageBox({ 42 | title = 'Set Your Reminder', 43 | inputs = {{name = 'Enter Reminder Text', vkPlugin = 'TextInput', maxTextLength = 1000}}, 44 | commands = CommandTable 45 | }) 46 | 47 | if (reminder.result == 1) then 48 | for name, value in pairs(reminder.inputs) do 49 | table.insert(NextReminder, tostring(value)) 50 | end 51 | elseif (reminder.result == 2) then 52 | for name, value in pairs(reminder.inputs) do 53 | table.insert(PostRReminder, tostring(value)) 54 | end 55 | elseif(reminder.result == 3) then 56 | for name, value in pairs(reminder.inputs) do 57 | table.insert(PostSReminder, tostring(value)) 58 | end 59 | elseif(reminder.result == 4) then 60 | for name, value in pairs(reminder.inputs) do 61 | table.insert(PostS2Reminder, tostring(value)) 62 | end 63 | end 64 | end 65 | return SetReminder -------------------------------------------------------------------------------- /Custom UI Elements/Pt 2 Example 2.lua: -------------------------------------------------------------------------------- 1 | local pluginName = select(1, ...) 2 | local componentName = select(2, ...) 3 | local signalTable = select(3, ...) 4 | local myHandle = select(4, ...) 5 | function Example() 6 | local CheckboxState = 'Unclicked' 7 | 8 | local baseInput = GetFocusDisplay().ScreenOverlay:Append('BaseInput') 9 | baseInput.Name = 'DMXTesterWindow' 10 | baseInput.H = 0 11 | baseInput.W = 600 12 | baseInput.Columns = 1 13 | baseInput.Rows = 2 14 | baseInput[1][1].SizePolicy = 'Fixed' 15 | baseInput[1][1].Size = 60 16 | baseInput[1][2].SizePolicy = 'Stretch' 17 | baseInput.AutoClose = 'No' 18 | baseInput.CloseOnEscape = 'Yes' 19 | 20 | local titleBar = baseInput:Append('TitleBar') 21 | titleBar.Columns = 2 22 | titleBar.Rows = 1 23 | titleBar.Anchors = '0,0' 24 | titleBar[2][2].SizePolicy = 'Fixed' 25 | titleBar[2][2].Size = 50 26 | titleBar.Texture = 'corner2' 27 | 28 | local titleBarIcon = titleBar:Append('TitleButton') 29 | titleBarIcon.Text = 'Dialog Example' 30 | titleBarIcon.Texture = 'corner1' 31 | titleBarIcon.Anchors = '0,0' 32 | titleBarIcon.Icon = 'star' 33 | 34 | local titleBarCloseButton = titleBar:Append('CloseButton') 35 | titleBarCloseButton.Anchors = '1,0' 36 | titleBarCloseButton.Texture = 'corner2' 37 | 38 | local dlgFrame = baseInput:Append('DialogFrame') 39 | dlgFrame.H = '100%' 40 | dlgFrame.W = '100%' 41 | dlgFrame.Columns = 1 42 | dlgFrame.Rows = 3 --Changed rows to 3 43 | dlgFrame.Anchors = '0,1' 44 | dlgFrame[1][1].SizePolicy = 'Fixed' 45 | dlgFrame[1][1].Size = 60 46 | dlgFrame[1][2].SizePolicy = 'Fixed' 47 | dlgFrame[1][2].Size = 60 48 | dlgFrame[1][3].SizePolicy = 'Fixed' 49 | dlgFrame[1][3].Size = 60 50 | 51 | local subTitle = dlgFrame:Append('UIObject') 52 | subTitle.Text = 'This example contains a subtitle.' 53 | subTitle.ContentDriven = 'Yes' 54 | subTitle.ContentWidth = 'No' 55 | subTitle.TextAutoAdjust = 'Yes' 56 | subTitle.Anchors = '0, 0' 57 | subTitle.Padding = '20, 15' 58 | subTitle.Font = 'Medium20' 59 | subTitle.HasHover = 'No' 60 | subTitle.BackColor = Root().ColorTheme.ColorGroups.Global.Transparent 61 | 62 | --Added checkBoxGrid to contain the checkboxes 63 | local checkBoxGrid = dlgFrame:Append("UILayoutGrid") 64 | checkBoxGrid.Columns = 1 65 | checkBoxGrid.Rows = 1 66 | checkBoxGrid.Anchors = '0,1' 67 | checkBoxGrid.Margin = '0,5' 68 | 69 | --Added a checkbox 70 | local checkBox1 = checkBoxGrid:Append("CheckBox") 71 | checkBox1.Anchors = '0,0' 72 | checkBox1.Text = "Check Box 1" 73 | checkBox1.TextalignmentH = "Left" 74 | checkBox1.State = 0 75 | checkBox1.PluginComponent = myHandle 76 | checkBox1.Clicked = "CheckBoxClicked" 77 | 78 | local buttonGrid = dlgFrame:Append('UILayoutGrid') 79 | buttonGrid.Columns = 1 80 | buttonGrid.Rows = 1 81 | buttonGrid.Anchors = '0,2' --Changed this to be the third row of the dlgFrame, since checkboxGrid is second 82 | 83 | local applyButton = buttonGrid:Append('Button') 84 | applyButton.Anchors = '0,0' 85 | applyButton.Textshadow = 1 86 | applyButton.HasHover = 'Yes' 87 | applyButton.Text = 'Apply' 88 | applyButton.Font = 'Medium20' 89 | applyButton.TextalignmentH = 'Centre' 90 | applyButton.PluginComponent = myHandle 91 | applyButton.Clicked = 'ButtonClicked' 92 | 93 | --Added a function to change the state of the checkbox if it is clicked 94 | signalTable.CheckBoxClicked = function(caller) 95 | if (caller.State == 1) then 96 | caller.State = 0 97 | else 98 | caller.State = 1 99 | end 100 | 101 | if (checkBox1.State == 0) then 102 | CheckboxState = 'Unclicked' 103 | else 104 | CheckboxState = 'Clicked' 105 | end 106 | end 107 | 108 | signalTable.ButtonClicked = function(caller) 109 | GetFocusDisplay().ScreenOverlay:ClearUIChildren() 110 | Printf(CheckboxState) 111 | end 112 | 113 | 114 | end 115 | return Example -------------------------------------------------------------------------------- /Lua for GrandMA3/Ep 5 - UI Elements and MessageBox.lua: -------------------------------------------------------------------------------- 1 | function main() 2 | -- To retrieve the returned information provided by the MessageBox function, set a variable to the function 3 | 4 | local returnTable = MessageBox({ 5 | --[[ 6 | The main elements included in the MessageBox function are: 7 | Title - singular element 8 | Message - singular element 9 | Inputs - displayed in alphabetical ordere 10 | Radio Selectors - displayed in the order defined 11 | Swipe Selectors - displayed in the order defined 12 | States (Checkboxes) - displayed in alphabetical order 13 | Commands - displayed in the order defined 14 | 15 | These elements will always be displayed in this order; there is no way to alter it. 16 | ]] 17 | 18 | -- The values referring to the title 19 | title = 'My Example MessageBox', -- The title for your messagebox 20 | titleTextColor = 1.7, -- The color for the title text. This references the colortheme in your showfile 21 | backColor = 1.11, -- The background color for the messagebox title bar and border. Also references the color theme in your showfile 22 | icon = 'object_smart', -- An icon for the left side of the title bar. The options can be found by using 'List' in the GraphicsRoot/TextureCollect/Textures cmd line destination 23 | 24 | -- The values referring to the message 25 | message = 'This is my example message text.\nI can create a line break with backslash "n"', -- The text displayed in your messagebox 26 | messageTextColor = 'Global.AlertText', -- The color for the message text. This references the colortheme in your showfile 27 | 28 | -- The values that define what can close the messagebox 29 | autoCloseOnInput = false, -- Boolean which determines whether the messagebox will close when you press please or enter (true) or if it will wait for you to close it (false) 30 | timeout = 10000, -- Milliseconds until the messagebox autocloses 31 | timeoutResultCancel = true, -- Boolean which affects the result returned by the messagebox timing out 32 | timeoutResultID = 36, -- Optional specific value to be returned if the messagebox times out 33 | 34 | -- Commands are buttons which will automatically close the messagebox when pressed. The command's value is returned by the function 35 | --'commands' requires a table of data for the commands. That table of commands requires an individual table for each command 36 | -- Commands are displayed in the order in which they appear in the table 37 | commands = {{ 38 | value = 1, -- Returned if the button is pressed 39 | name = 'Yay!' -- Displayed on the button 40 | }, { 41 | value = 2, 42 | name = 'Ok Whatever' 43 | }}, 44 | 45 | -- Inputs are spaces where you can add text. This text is returned by the function 46 | --'inputs' requires a table of data for the inputs. That table of inputs requires an individual table for each input 47 | -- Inputs are displayed in alphabetical order based on the name of each input 48 | inputs = {{ 49 | name = 'Input 1', -- Displayed on the input; determines the inputs' location alphabetically relative to the other inputs 50 | value = 'Letters Only', -- The default value which is displayed in the input space 51 | blackFilter = '1234567890', -- Characters which can NOT be entered by the user 52 | vkPlugin = 'TextInput', -- Defines what type of keyboard is displayed if the keyboard icon is pressed. See user manual for options 53 | maxTextLength = 10 -- Max number of allowed characters 54 | }, { 55 | name = 'Input 2', 56 | value = 'Numbers Only', 57 | whiteFilter = '1234567890', -- Characters which CAN be entered by the user - anything not included can NOT be entered 58 | vkPlugin = 'NumericInput' 59 | }, { 60 | name = 'Input 3', 61 | value = 'Cue ID', 62 | whiteFilter = '1234567890.', 63 | vkPlugin = 'CueNumberInput' 64 | }}, 65 | 66 | -- States are checkboxes which can be checked or unchecked. The state is returned by the function 67 | --'states' requires a table of data for the states. That table of states requires an individual table for each state 68 | -- States are displayed in alphabetical order based on the name of each state 69 | states = {{ 70 | name = 'Checkbox', -- The name displayed on the checkbox 71 | state = false -- Boolean determining if the checkbox defaults to checked (true) or unchecked (false) 72 | }}, 73 | 74 | -- Selectors include two types of buttons: Swipe buttons (type 0) or Radio buttons (type 1). The selected value is returned by the function 75 | --'selectors' requires a table of data for the selectors. That table of selectors requires an individual table for each selector 76 | -- Selectors are displayed in the order in which they appear in the table, but Radio buttons are always displayed before Swipe buttons 77 | selectors = {{ 78 | name = 'Swipe Selector', -- The name displayed on the selector 79 | selectedValue = 1, -- The value that will be seleceted by default 80 | type = 0, -- The type of selector 81 | values = {['Option 1'] = 1, ['Option 2'] = 2, ['Option 3'] = 3} -- The values: ['Displayed Name'] = value (to be returned) 82 | }, { 83 | name = 'Radio Selector', 84 | selectedValue = 1, 85 | type = 1, 86 | values = {['Option 1'] = 1, ['Option 2'] = 2, ['Option 3'] = 3} 87 | }} 88 | }) 89 | 90 | -- The values returned by the MessageBox function are stored in a table. To read them, we must access the corresponding table values. 91 | success = returnTable.success -- Boolean returns true if the table is closed by a timeout or a command button unless timeoutResultCancel is set to true, in which case it is false 92 | result = returnTable.result -- Returns the value of the command button that is pressed or the timeoutResultID, if defined, depending on how the pop-up was closed 93 | inputs = returnTable.inputs -- Returns a table with key/value pairs made up of the inputs' names and values 94 | states = returnTable.states -- Returns a table with key/value pairs made up of the states' names and boolean values 95 | selectors = returnTable.selectors -- Returns a table with key/value pairs made up of the selectors' names and boolean values 96 | end 97 | return main -------------------------------------------------------------------------------- /Miscellaneous/Complete MessageBox.lua: -------------------------------------------------------------------------------- 1 | function main() 2 | -- To retrieve the returned information provided by the MessageBox function, set a variable to the function 3 | 4 | local returnTable = MessageBox({ 5 | --[[ 6 | The main elements included in the MessageBox function are: 7 | Title - singular element 8 | Message - singular element 9 | Inputs - displayed in alphabetical ordere 10 | Radio Selectors - displayed in the order defined 11 | Swipe Selectors - displayed in the order defined 12 | States (Checkboxes) - displayed in alphabetical order 13 | Commands - displayed in the order defined 14 | 15 | These elements will always be displayed in this order; there is no way to alter it. 16 | ]] 17 | 18 | -- The values referring to the title 19 | title = 'My Example MessageBox', -- The title for your messagebox 20 | titleTextColor = 1.7, -- The color for the title text. This references the colortheme in your showfile 21 | backColor = 1.11, -- The background color for the messagebox title bar and border. Also references the color theme in your showfile 22 | icon = 'object_smart', -- An icon for the left side of the title bar. The options can be found by using 'List' in the GraphicsRoot/TextureCollect/Textures cmd line destination 23 | 24 | -- The values referring to the message 25 | message = 'This is my example message text.\nI can create a line break with backslash "n"', -- The text displayed in your messagebox 26 | messageTextColor = 'Global.AlertText', -- The color for the message text. This references the colortheme in your showfile 27 | message_align_h = Enums.AlignmentH.Left, -- The horizontal alignment of your message text in the box. Can be Left, Right, or Center (default) 28 | 29 | -- The values that define what can close the messagebox 30 | autoCloseOnInput = false, -- Boolean which determines whether the messagebox will close when you press please or enter (true) or if it will wait for you to close it (false) 31 | timeout = 10000, -- Milliseconds until the messagebox autocloses 32 | timeoutResultCancel = true, -- Boolean which affects the result returned by the messagebox timing out 33 | timeoutResultID = 36, -- Optional specific value to be returned if the messagebox times out 34 | 35 | -- Commands are buttons which will automatically close the messagebox when pressed. The command's value is returned by the function 36 | --'commands' requires a table of data for the commands. That table of commands requires an individual table for each command 37 | -- Commands are displayed in the order in which they appear in the table 38 | commands = {{ 39 | value = 1, -- Returned if the button is pressed 40 | name = 'Yay!' -- Displayed on the button 41 | }, { 42 | value = 2, 43 | name = 'Ok Whatever' 44 | }}, 45 | 46 | -- Inputs are spaces where you can add text. This text is returned by the function 47 | --'inputs' requires a table of data for the inputs. That table of inputs requires an individual table for each input 48 | -- Inputs are displayed in alphabetical order based on the name of each input 49 | inputs = {{ 50 | name = 'Input 1', -- Displayed on the input; determines the inputs' location alphabetically relative to the other inputs 51 | value = 'Letters Only', -- The default value which is displayed in the input space 52 | blackFilter = '1234567890', -- Characters which can NOT be entered by the user 53 | vkPlugin = 'TextInput', -- Defines what type of keyboard is displayed if the keyboard icon is pressed. See user manual for options 54 | maxTextLength = 10 -- Max number of allowed characters 55 | }, { 56 | name = 'Input 2', 57 | value = 'Numbers Only', 58 | whiteFilter = '1234567890', -- Characters which CAN be entered by the user - anything not included can NOT be entered 59 | vkPlugin = 'NumericInput' 60 | }, { 61 | name = 'Input 3', 62 | value = 'Cue ID', 63 | whiteFilter = '1234567890.', 64 | vkPlugin = 'CueNumberInput' 65 | }}, 66 | 67 | -- States are checkboxes which can be checked or unchecked. The state is returned by the function 68 | --'states' requires a table of data for the states. That table of states requires an individual table for each state 69 | -- States are displayed in alphabetical order based on the name of each state 70 | states = {{ 71 | name = 'Checkbox', -- The name displayed on the checkbox 72 | state = false -- Boolean determining if the checkbox defaults to checked (true) or unchecked (false) 73 | }}, 74 | 75 | -- Selectors include two types of buttons: Swipe buttons (type 0) or Radio buttons (type 1). The selected value is returned by the function 76 | --'selectors' requires a table of data for the selectors. That table of selectors requires an individual table for each selector 77 | -- Selectors are displayed in the order in which they appear in the table, but Radio buttons are always displayed before Swipe buttons 78 | selectors = {{ 79 | name = 'Swipe Selector', -- The name displayed on the selector 80 | selectedValue = 1, -- The value that will be seleceted by default 81 | type = 0, -- The type of selector 82 | values = {['Option 1'] = 1, ['Option 2'] = 2, ['Option 3'] = 3} -- The values: ['Displayed Name'] = value (to be returned) 83 | }, { 84 | name = 'Radio Selector', 85 | selectedValue = 1, 86 | type = 1, 87 | values = {['Option 1'] = 1, ['Option 2'] = 2, ['Option 3'] = 3} 88 | }} 89 | }) 90 | 91 | -- The values returned by the MessageBox function are stored in a table. To read them, we must access the corresponding table values. 92 | success = returnTable.success -- Boolean returns true if the table is closed by a timeout or a command button unless timeoutResultCancel is set to true, in which case it is false 93 | result = returnTable.result -- Returns the value of the command button that is pressed or the timeoutResultID, if defined, depending on how the pop-up was closed 94 | inputs = returnTable.inputs -- Returns a table with key/value pairs made up of the inputs' names and values 95 | states = returnTable.states -- Returns a table with key/value pairs made up of the states' names and boolean values 96 | selectors = returnTable.selectors -- Returns a table with key/value pairs made up of the selectors' names and boolean values 97 | end 98 | return main -------------------------------------------------------------------------------- /Custom UI Elements/Pt 3 Example.lua: -------------------------------------------------------------------------------- 1 | local pluginName = select(1, ...) 2 | local componentName = select(2, ...) 3 | local signalTable = select(3, ...) 4 | local myHandle = select(4, ...) 5 | function CustomChecklist(Table) 6 | local DialogColumns = 0 7 | local DialogRows = 0 8 | local ElementPositionH = {} 9 | local ElementPositionV = {} 10 | local Element = {} 11 | local CheckboxState = {} 12 | local continue = false 13 | 14 | if (Table.dialogWidth == nil) then 15 | DialogWidth = 700 16 | else 17 | DialogWidth = Table.dialogWidth 18 | end 19 | 20 | for i = 1,100 do 21 | if (Table.elements[i] ~= nil) then 22 | if (Table.elements[1].positionH == nil) then 23 | ElementPositionH[i] = 0 24 | elseif(Table.elements[i].positionH ~= nil) then 25 | ElementPositionH[i] = Table.elements[i].positionH - 1 26 | end 27 | 28 | if (Table.elements[i].positionV == nil) then 29 | ElementPositionV[i] = i - 1 30 | else 31 | ElementPositionV[i] = Table.elements[i].positionV - 1 32 | end 33 | 34 | if (DialogColumns < ElementPositionH[i] + 1) then 35 | DialogColumns = ElementPositionH[i] + 1 36 | end 37 | 38 | if (DialogRows < ElementPositionV[i] + 1) then 39 | DialogRows = ElementPositionV[i] + 1 40 | end 41 | else 42 | break 43 | end 44 | end 45 | 46 | local baseInput = GetFocusDisplay().ScreenOverlay:Append('BaseInput') 47 | baseInput.Name = 'DMXTesterWindow' 48 | baseInput.H = 0 49 | baseInput.W = DialogWidth 50 | baseInput.Columns = 1 51 | baseInput.Rows = 2 52 | baseInput[1][1].SizePolicy = 'Fixed' 53 | baseInput[1][1].Size = 60 54 | baseInput[1][2].SizePolicy = 'Stretch' 55 | baseInput.AutoClose = 'No' 56 | baseInput.CloseOnEscape = 'Yes' 57 | 58 | local titleBar = baseInput:Append('TitleBar') 59 | titleBar.Columns = 2 60 | titleBar.Rows = 1 61 | titleBar.Anchors = '0,0' 62 | titleBar[2][2].SizePolicy = 'Fixed' 63 | titleBar[2][2].Size = 50 64 | titleBar.Texture = 'corner2' 65 | 66 | local titleBarIcon = titleBar:Append('TitleButton') 67 | titleBarIcon.Text = Table.title 68 | titleBarIcon.Texture = 'corner1' 69 | titleBarIcon.Anchors = '0,0' 70 | titleBarIcon.Icon = 'star' 71 | 72 | local titleBarCloseButton = titleBar:Append('CloseButton') 73 | titleBarCloseButton.Anchors = '1,0' 74 | titleBarCloseButton.Texture = 'corner2' 75 | 76 | local dlgFrame = baseInput:Append('DialogFrame') 77 | dlgFrame.H = '100%' 78 | dlgFrame.W = '100%' 79 | dlgFrame.Columns = 1 80 | dlgFrame.Rows = 2 81 | dlgFrame.Anchors = '0,1' 82 | dlgFrame[1][1].SizePolicy = 'Fixed' --This should be set to stretch so you can have multiple rows of checkboxes without issue 83 | dlgFrame[1][1].Size = 60 --This line should be deleted if the previous line is set to stretch 84 | dlgFrame[1][2].SizePolicy = 'Fixed' 85 | dlgFrame[1][2].Size = 60 86 | 87 | local checkBoxGrid = dlgFrame:Append("UILayoutGrid") 88 | checkBoxGrid.Columns = DialogColumns 89 | checkBoxGrid.Rows = DialogRows 90 | checkBoxGrid.Anchors = '0,0' 91 | checkBoxGrid.Margin = '0,5' 92 | 93 | local function ActivateCheckbox(index) 94 | Element[index] = checkBoxGrid:Append("CheckBox") 95 | Element[index].Anchors = { 96 | top = ElementPositionV[index], 97 | bottom = ElementPositionV[index], 98 | left = ElementPositionH[index], 99 | right = ElementPositionH[index] 100 | } 101 | Element[index].Text = Table.elements[index].name 102 | Element[index].TextalignmentH = "Left" 103 | Element[index].State = CheckboxState[index] 104 | Element[index].PluginComponent = myHandle 105 | Element[index].Clicked = "CheckBoxClicked" 106 | end 107 | 108 | local function ActivateSubtitle(index) 109 | Element[index] = checkBoxGrid:Append('UIObject') 110 | Element[index].Text = Table.elements[index].name 111 | Element[index].ContentDriven = 'Yes' 112 | Element[index].ContentWidth = 'No' 113 | Element[index].TextAutoAdjust = 'Yes' 114 | Element[index].Anchors = { 115 | top = ElementPositionV[index], 116 | bottom = ElementPositionV[index], 117 | left = ElementPositionH[index], 118 | right = ElementPositionH[index] 119 | } 120 | Element[index].Padding = '20, 15' 121 | Element[index].Font = 'Medium20' 122 | Element[index].HasHover = 'No' 123 | Element[index].BackColor = Root().ColorTheme.ColorGroups.Global.Transparent 124 | end 125 | 126 | for i = 1,100 do 127 | if (Table.elements[i] ~= nil) then 128 | if (Table.elements[i].type == 'Checkbox') then 129 | if (Table.elements[i].state == 1) then 130 | CheckboxState[i] = 1 131 | else 132 | CheckboxState[i] = 0 133 | end 134 | ActivateCheckbox(i) 135 | elseif(Table.elements[i].type == 'Subtitle') then 136 | ActivateSubtitle(i) 137 | end 138 | else 139 | break 140 | end 141 | end 142 | 143 | local buttonGrid = dlgFrame:Append('UILayoutGrid') 144 | buttonGrid.Columns = 1 145 | buttonGrid.Rows = 1 146 | buttonGrid.Anchors = '0,1' 147 | 148 | local applyButton = buttonGrid:Append('Button') 149 | applyButton.Anchors = '0,0' 150 | applyButton.Textshadow = 1 151 | applyButton.HasHover = 'Yes' 152 | applyButton.Text = 'Apply' 153 | applyButton.Font = 'Medium20' 154 | applyButton.TextalignmentH = 'Centre' 155 | applyButton.PluginComponent = myHandle 156 | applyButton.Clicked = 'ButtonClicked' 157 | 158 | 159 | signalTable.CheckBoxClicked = function(caller) 160 | if (caller.State == 1) then 161 | caller.State = 0 162 | else 163 | caller.State = 1 164 | end 165 | 166 | for i = 1, 100 do 167 | if (Element[i] ~= nil) then 168 | if (Element[i].State == 0) then 169 | CheckboxState[i] = 0 170 | elseif (Element[i].State == 1) then 171 | CheckboxState[i] = 1 172 | end 173 | end 174 | end 175 | end 176 | 177 | signalTable.ButtonClicked = function(caller) 178 | GetFocusDisplay().ScreenOverlay:ClearUIChildren() 179 | continue = true 180 | end 181 | 182 | repeat 183 | until continue 184 | 185 | return CheckboxState 186 | end 187 | 188 | function main() 189 | if (myStates == nil) then 190 | myStates = {} 191 | end 192 | myStates = CustomChecklist({title = 'My new title', elements = {{ 193 | type = 'Subtitle', name = 'Text to display', positionH = 1, positionV = 1},{ 194 | type = 'Checkbox', name = 'Text on Checkbox', positionH = 2, positionV = 1, state = myStates[2]}, { 195 | type = 'Checkbox', name = 'Checkbox 2', positionH = 3, positionV = 1, state = myStates[3] 196 | }}}) 197 | end 198 | return main --------------------------------------------------------------------------------