Here's a tip for creating pop up windows and organizing all the elements using "push" and "pop:.
If you can find any of the "Macton" or "Crashcore" scripts that use pop ups look at how they create the "layeout". It's in the beginning of the code. You may need to have some more lua experience to understand it but it truly is an easier way to organize the layout.
What they do is create a "function" that "builds" the layout. So instead of a huge long chunk of code you call a function that is easier to see and read. The formatting of the "push/pop" layout is the same each time you call that function. It makes designing pop up lay outs easier.
Here's is a snippet showing the function from one of those scripts:
Code:
function CC_PASTE_CURVE_TO_CAMERA_TRACK_Dialog:add_col_e4( l, el_0, el_1, el_2, el_3 )
l:PushV()
l:AddChild( el_0, LM.GUI.ALIGN_LEFT )
l:AddChild( el_1, LM.GUI.ALIGN_LEFT )
l:AddChild( el_2, LM.GUI.ALIGN_LEFT )
l:AddChild( el_3, LM.GUI.ALIGN_LEFT )
l:Pop()
end
If all the code to create those elements were INSIDE the "push/pop" it would be much longer and harder to read. Using a function with arguments and variables and sending the element data to the function keeps the code more compact and easy to read.
-vern
Thank you Vern. After having studied at bit more the structure of your script I understood what you mean.
Well, I created a nearly empty PopUpWindow that can't do anything. Absolutely nothing.
-- **************************************************
-- PopUpWindow
-- **************************************************
ScriptName = "sm_PopUpWindow"
-- **************************************************
-- General information about this script
-- **************************************************
sm_PopUpWindow = {}
function sm_PopUpWindow:UILabel()
return("PopUpWindow")
end
-- **************************************************
-- Grid dialog
-- **************************************************
local sm_PopUpWindowDialog = {}
function sm_PopUpWindowDialog:new(moho)
local d = LM.GUI.SimpleDialog("Test", sm_PopUpWindowDialog)
local l = d:GetLayout()
d.moho = moho
l:PushH(LM.GUI.ALIGN_LEFT)
d.Flip = LM.GUI.StaticText("")
l:AddChild(d.Flip)
l:Pop()
return d
end
function sm_PopUpWindowDialog:OnValidate()
end
-- **************************************************
-- The guts of this script
-- **************************************************
function sm_PopUpWindow:Run(moho)
local dlog = sm_PopUpWindowDialog:new(moho)
if (dlog:DoModeless()) then
return
end
end
Now, I'm trying to put graphical elements into it.
To begin, I would like to enter a filled circle into this PopUp window.
The Anime Studio lua GUI chapter contains several commands especially for the creation of graphics.
I think that these elements will certainly be part of those which have to be put together in order to create and to show the circle.
bool IsEnabled()
int Width()
int Height()
FillCircle(center, radius)
But, I really don't find out how all this has to work together.
How could this be integrated to the Layout of the LM.GUI.SimpleDialog?
And, how could this to match into this:
Or, is it just really impossible to create graphical elements and to integrate them in AS's interface?l:PushH(LM.GUI.ALIGN_LEFT)
d.Flip = ?????????????,
l:AddChild(d.Flip)
l:Pop()
But, I think that it must be possible. As the mentioned commands are in the GUI part of the scripting reference.
desperate stefman