Dynamically Created Functions
by Scott Doerrfeld · in Torque Game Engine · 06/03/2008 (5:39 am) · 2 replies
Or I should say function calls for dynamically created objects. Will someone please tell me the proper syntax for adding functions to dynamically created GUIs? For example, how do I define the "onSelect" callback for this dynamically created GuiTextListCtrl:
function createNewList(%newList)
{
new GuiTextListCtrl(%newList) {
canSaveDynamicFields = "0";
Profile = "HudTextProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "1 1";
Extent = "270 8";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
enumerate = "0";
resizeCell = "1";
columns = "0 120";
FitParentWidth = "1";
clipColumnText = "0";
};
}
function createNewList(%newList)
{
new GuiTextListCtrl(%newList) {
canSaveDynamicFields = "0";
Profile = "HudTextProfile";
HorizSizing = "width";
VertSizing = "bottom";
Position = "1 1";
Extent = "270 8";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
enumerate = "0";
resizeCell = "1";
columns = "0 120";
FitParentWidth = "1";
clipColumnText = "0";
};
}
About the author
#2
eval("function " @ %newList @ "::onSelect(%this){}");
Thanks!
06/03/2008 (7:32 am)
Yup the eval worked:eval("function " @ %newList @ "::onSelect(%this){}");
Thanks!
Torque 3D Owner Ted Southard