I'm playing with the UI, trying to learn how it all works together. Still very new to Lua but coming from Python and BASIC languages it's not completely foreign. Took me way longer than it should have to realize the difference between : and . when calling methods. Crashed Moho so many times.
Anyway, I want to make sure I'm approaching this from the best way possible.
I've created a simple dialog with 9 radio buttons arranged in a square (representing the deformation square nodes plus the center)
* * *
* * *
* * *
The way I did this was first pushing Vertical, then pushing Horizontal, adding three children, popping to the next row, pushing horizontal adding three more children, and the same for the last row.
Each row became it's own selection group meaning that I could select one radio button from each row which is not what I wanted, but I couldn't see any options for defining the groups in code. I'm assuming it's automatic based on the view and where I popped to the next column or row.
So, assuming there wasn't a way to define all 9 elements as being part of the same group I used HandleMessage to deselect any radio button that isn't the recipient of the message.
Code: Select all
function msSetOriginDialog:HandleMessage(msg)
if msg < 50 or msg > 58 then return end -- Avoid OK and Cancel buttons disabling everything.
if msg ~= 50 then self.TL:SetValue(false) end
if msg ~= 51 then self.TC:SetValue(false) end
if msg ~= 52 then self.TR:SetValue(false) end
if msg ~= 53 then self.ML:SetValue(false) end
if msg ~= 54 then self.MM:SetValue(false) end
if msg ~= 55 then self.MR:SetValue(false) end
if msg ~= 56 then self.BL:SetValue(false) end
if msg ~= 57 then self.BC:SetValue(false) end
if msg ~= 58 then self.BR:SetValue(false) end
end
Any insights are greatly appreciated. Thank you.