Wrong way of doing adding a gui? GuiControl.add crashes..
by Terence Tan · in Torque Game Engine · 08/02/2006 (8:31 am) · 4 replies
Hi,
I am working on an editor right now for our game and I am trying to simply add a different set of Gui controls based on a tree selection. (gallery.filefront.com/terenctb/).
The Content part is an embeded GuiControl and I do this:
TalkEditorContent.add(TalkEditorDialogGui);
where TalkEditorDialogGui is another Guicontrol. Everthing appears ok until I try 'clicking' on any of the components where it crashes...
A way around this is possibly to create all the gui controls and hide them via set visible?
Just wondering if I am approaching this the wrong way before I go ahead and change things? The crash seems to indicate that the guicontent pointers are some how undefined..leading me to believe that this isn't the way things should work?
I am working on an editor right now for our game and I am trying to simply add a different set of Gui controls based on a tree selection. (gallery.filefront.com/terenctb/).
The Content part is an embeded GuiControl and I do this:
TalkEditorContent.add(TalkEditorDialogGui);
where TalkEditorDialogGui is another Guicontrol. Everthing appears ok until I try 'clicking' on any of the components where it crashes...
A way around this is possibly to create all the gui controls and hide them via set visible?
Just wondering if I am approaching this the wrong way before I go ahead and change things? The crash seems to indicate that the guicontent pointers are some how undefined..leading me to believe that this isn't the way things should work?
About the author
#2
" ctrl = mContentControl->findHitControl(mLastMousePos, mCurrentAddSet->mLayer);"
mContentControl is 0xcfcfcfcf..which being undefined.
The definition of the GuiControl works because I tested it with a Canvas.pushdialog(TalkEditorDialogGui)...
Did a basic UI:
This crashes too...
08/02/2006 (9:31 am)
It basically breaks in guiEditCtrl.cc at line 569: GuiEditCtrl::onMouseDown" ctrl = mContentControl->findHitControl(mLastMousePos, mCurrentAddSet->mLayer);"
mContentControl is 0xcfcfcfcf..which being undefined.
The definition of the GuiControl works because I tested it with a Canvas.pushdialog(TalkEditorDialogGui)...
Did a basic UI:
new GuiControl(TestGui) {
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "1024 768";
MinExtent = "8 2";
Visible = "1";
new GuiBitmapButtonCtrl() {
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 128";
Extent = "32 32";
MinExtent = "8 2";
Visible = "1";
text = " ";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "./leftarrow";
command="TalkEditorDialogPrevPerson();";
};
new GuiBitmapButtonCtrl() {
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "96 128";
Extent = "8 22";
MinExtent = "32 32";
Visible = "1";
text = " ";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "./rightarrow";
command="TalkEditorDialogNextPerson();";
};
};This crashes too...
#3
Did I say I am a Singapore and had a few beers and magherita's too many with Benjamin Bradley...well I did...creative inebriated programming;P...thanks orion
08/02/2006 (9:43 am)
Duh..nevermind......Doh...Had a stupid edit control overlayed on top..my bad!Did I say I am a Singapore and had a few beers and magherita's too many with Benjamin Bradley...well I did...creative inebriated programming;P...thanks orion
#4
08/02/2006 (9:59 am)
Heh. glad you got it going. ben bradley is in singapore ? what's going on in singapore ?
Associate Orion Elenzil
Real Life Plus
the project i'm working on does lots of dynamic adding of GuiControls to other GuiControls, seems to work fine.
maybe try to reduce your situation to the simplest case that reveals the problem ?
or run the engine in debug mode and see why it's crashing. it might be something obvious.