Problem getting guiT2DObjectCtrl to work
by Simon Jensen · in Torque Game Builder · 08/13/2007 (4:23 pm) · 13 replies
I'm creating my gui and I've got a guiT2DObjectCtrl that works inside the GUI editor, but when I attempt to push the dialog onto the screen I get an error of:
Unable to instantiate non-conObject Class guiT2DObjectCtrl.
Can anyone shed some light on what that means? What's Non-Con? Does that mean it hasnt been to jail?
Or maybe I'm completely confused and this isnt the way to have a t2dScroller object inside a Gui....
here's the Gui object
and here's the sceneObject from the level file
Unable to instantiate non-conObject Class guiT2DObjectCtrl.
Can anyone shed some light on what that means? What's Non-Con? Does that mean it hasnt been to jail?
Or maybe I'm completely confused and this isnt the way to have a t2dScroller object inside a Gui....
here's the Gui object
new guiT2DObjectCtrl(Holder) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "MicroDocMainGUI";
HorizSizing = "right";
VertSizing = "bottom";
Position = "19 16";
Extent = "122 45";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
groupNum = "-1";
buttonType = "RadioButton";
useMouseEvents = "0";
renderMargin = "0";
sceneObject = "heartMonitorSprite";
};and here's the sceneObject from the level file
new t2dScroller(heartMonitorSprite) {
imageMap = "heartMonitorImageMap";
repeatX = "2";
scrollX = "3";
scrollPositionX = "0.305347";
canSaveDynamicFields = "1";
class = "LevelStats";
Position = "-47.861 -50.342";
size = "16.000 8.000";
BlendColor = "0 0.792157 0.160784 1";
mountID = "11";
};
#2
08/20/2007 (9:27 am)
I have no idea how the guiT2DobjectCtrl works, but I am curious as well. sry.
#3
sceneObject = "heartMonitorSprite"; ==> sceneObject = heartMonitorSprite;
Just somethin to try..
08/20/2007 (1:01 pm)
Could you post your code that you use push your dialog. Also have you played around with removing the double quotes from sceneObject = "heartMonitorSprite"; ==> sceneObject = heartMonitorSprite;
Just somethin to try..
#4
So I started picking some more at this problem.
Here's the code I'm using to push the GUI along with some debug junk I've been trying
Here's what I get in the console.

The Really strange thing is that when I enter the Holder's scene object from within the GUI editor, it looks like it WORKS!

But then I save the gui, close TGB, restart TGB and go into the GUI editor and load the gui. And the Holder.sceneObject value doesn't populate. However it's still listed (with quotes) inside the actual file.

Any thoughts on how to track this down further,
08/20/2007 (8:12 pm)
Thanks for the suggestions. I went ahead and tried it without the quotes, no luck unfortunately. So I started picking some more at this problem.
Here's the code I'm using to push the GUI along with some debug junk I've been trying
warn(heartMonitorSprite.Position SPC "is heartMonitor position by name reference"); Holder.sceneObject = heartMonitorSprite; Canvas.pushDialog(MainGameLevelGui); warn(Holder.sceneObject.Position SPC "is heartMonitor position by Holder reference");
Here's what I get in the console.

The Really strange thing is that when I enter the Holder's scene object from within the GUI editor, it looks like it WORKS!

But then I save the gui, close TGB, restart TGB and go into the GUI editor and load the gui. And the Holder.sceneObject value doesn't populate. However it's still listed (with quotes) inside the actual file.

Any thoughts on how to track this down further,
#5
according to a discussion about a year ago
about 2/3rds of the way down this page www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10136
Now they were talking about a custom class they were trying to add to the engine. I'm using the TGB 1.5.1 straight outta the box. Any chance that guiT2DObjectCtrl wasn't compiled into the latest version?
Anyone have a compiler handy and can check? I'm afraid I've never messed with the source and wouldn't even begin to know where to look for this stuff...
08/20/2007 (8:32 pm)
One further pseudo update.according to a discussion about a year ago
about 2/3rds of the way down this page www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10136
Alex Rice (Jul 04, 2006 at 00:53) Resource Rating: 5
Also the warning about "Unable to instantiate non-conobject class" just means that the t2dTextObject class was not compiled into TGB.exe.Now they were talking about a custom class they were trying to add to the engine. I'm using the TGB 1.5.1 straight outta the box. Any chance that guiT2DObjectCtrl wasn't compiled into the latest version?
Anyone have a compiler handy and can check? I'm afraid I've never messed with the source and wouldn't even begin to know where to look for this stuff...
#6
tdn.garagegames.com/wiki/TGB/Reference:_guiT2DObjectCtrl
Based on the documentation you need to change this
Holder.sceneObject = heartMonitorSprite; ==> Holder.sceneObject = "heartMonitorSprite";
or change to
Holder.setSceneObject(heartMonitorSprite);
That looks like it might work for you
08/21/2007 (3:41 am)
Here is a link to some documentation about the guiT2DObjectCtrl i foundtdn.garagegames.com/wiki/TGB/Reference:_guiT2DObjectCtrl
Based on the documentation you need to change this
Holder.sceneObject = heartMonitorSprite; ==> Holder.sceneObject = "heartMonitorSprite";
or change to
Holder.setSceneObject(heartMonitorSprite);
That looks like it might work for you
#8
'unable to find object Holder attempting to call function setSceneObject'
Which is strange because the gui is displaying and I can query the 'heartMonitorGui' GuiBitmapCtrl that contains the Holder guiT2DObjectCtrl. But I am completely unable to get any info from the Holder object.
i think its all stemming from the
"Unable to instantiate non-conObject Class guiT2DObjectCtrl."
error that appears whenever i include the GUI into the project (even when not pushing it to the canvas)
08/24/2007 (7:48 am)
Nope, when I try and use the setSceneObject it gives me 'unable to find object Holder attempting to call function setSceneObject'
Which is strange because the gui is displaying and I can query the 'heartMonitorGui' GuiBitmapCtrl that contains the Holder guiT2DObjectCtrl. But I am completely unable to get any info from the Holder object.
i think its all stemming from the
"Unable to instantiate non-conObject Class guiT2DObjectCtrl."
error that appears whenever i include the GUI into the project (even when not pushing it to the canvas)
#9
08/27/2007 (9:12 am)
Is this the same object that the editor uses to display scene objects? Perhaps looking at the editors code could help, just an idea.
#10
I think this might solve your problem, maybe.
08/27/2007 (10:03 am)
Just a bit curious, but have you tried doing this://///////////
/// Add to the bottom of MainGameLevelGui
/////////////
function MainGameLevelGui::onWake()
{
Holder.sceneObject = heartMonitorSprite;
}I think this might solve your problem, maybe.
#11
08/27/2007 (10:42 am)
Ooh, I'll try that after work tonight.
#12
Go into Visual Studio and add engine\source\TGB\guiT2DObjectCtrl.h and .cc to the TGBGame project and rebuild
08/31/2007 (7:28 am)
Simon, your problem is that guiT2DObjectCtrl is an editor-only object in 1.5/1.5.1. TGB by default does not build them into TGBGame.exe, only TorqueGameBuilder.exeGo into Visual Studio and add engine\source\TGB\guiT2DObjectCtrl.h and .cc to the TGBGame project and rebuild
#13
08/31/2007 (7:38 am)
Thanks James.
Torque 3D Owner Simon Jensen
SwiftThought Games
Anyone .....