jungletek wrote: ↑Sun Mar 25, 2018 7:33 am
You should consider posting it for other people's enlightenment.
Nothing worse than seeing a post that matches what you're trying to do, and then the inevitable "Edit: NVM, figured it out".
I ended up solving my own issue. Let's say I want the function of one checkbox to check another checkbox and activate its function at the same time.
I could use this to activate the code above without even messing with the checkbox:
Code: Select all
function CECheckbox3Change(sender)
if ((checkbox_getState(UDF1.CECheckbox3)) == 1) then
t=createTimer(nil)
timer_setInterval(t, 1)
timer_onTimer(t, random)
else
t.destroy();
t=nil
end
checkbox_setState(UDF1.CECheckbox7, 1) //This sets the checkbox to be checked//
CECheckbox7Change(sender) //This calls the checkbox function, which then checks to see if the box is checked and then acts based on checked condition//
if ((checkbox_getState(UDF1.CECheckbox3)) == 0) then
checkbox_setState(UDF1.CECheckbox7, 0) //This sets the checkbox to be unchecked if it doesn't meet the condition of this box being checked//
CECheckbox7Change(sender) //This calls the checkbox function, which then checks to see if the box is checked and then acts based on checked condition//
end
end
So, if you want to set a checkbox via lua, you can do it via this:
Code: Select all
checkbox_setState(FormName.NameOfCheckbox, 0) //Sets Checkbox to Unchecked//
checkbox_setState(FormName.NameOfCheckbox, 1) //Sets Checkbox to Checked//
checkbox_setState(FormName.NameOfCheckbox, 2) //Sets Checkbox to Grayed if the Checkbox allows it//
If you then wanted to call the checkbox function outside of its function, you could do this:
Code: Select all
function SOMEOTHERFUNCTION()
YOUR CODE HERE
NameOfCheckboxChange(sender)
end
Make sure to call the function after everything you want to execute in SOMEOTHERFUNCTION, else that function will cease and the checkbox function will begin instead.