Game Development Community

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";
};
}

#1
06/03/2008 (7:02 am)
I would suppose an evail() with the script calls in there to create that function should be fine. Or, you can create a file and exec() it in script, then delete the file when done.
#2
06/03/2008 (7:32 am)
Yup the eval worked:

eval("function " @ %newList @ "::onSelect(%this){}");

Thanks!