Game Development Community

Add a GUI to another GUI?

by Bob Mann · in Torque 3D Beginner · 02/13/2011 (5:07 pm) · 6 replies

How would I go about like, making a GUI block and adding it to a GUI list or something?

#1
02/13/2011 (5:39 pm)
If you're referring to the playGUI being a single gui with multiple objects on it, you simply create one GUI object, and call Canvas.pushDialog(gui); on the other gui's, just make sure that the central GUI is the one receiving the input.
#2
02/13/2011 (6:25 pm)
No. I wish to use a script to make a new GUI object then add it to a GUI list (sorta like an inventory maybe).
#3
02/14/2011 (6:04 am)
Look into the "containers" category of the GUI designer.
#4
02/14/2011 (6:54 am)
If you're using a GUIStackCtrl (what I use for my crafting GUI list), then you can use .addGuiControl(%ctrl), where %ctrl is the GUI you want to add (these GUI controls can be generated dynamically very easily).
#5
02/15/2011 (6:34 pm)
I am getting a syntax error with this.
function clientCmdaddpost(%postername, %posttext, %postid)
{
	%Fblock = new GuiControl(%postid) {
		position = "0 0";
		extent = "1024 768";
		minExtent = "8 2";
		horizSizing = "right";
		vertSizing = "bottom";
		profile = "GuiDefaultProfile";
		visible = "1";
		active = "1";
		tooltipProfile = "GuiToolTipProfile";
		hovertime = "1000";
		isContainer = "1";
		canSave = "1";
		canSaveDynamicFields = "1";

		new GuiContainer() {
			margin = "0 0 0 0";
			padding = "0 0 0 0";
			anchorTop = "1";
			anchorBottom = "0";
			anchorLeft = "1";
			anchorRight = "0";
			position = "208 342";
			extent = "558 99";
			minExtent = "8 2";
			horizSizing = "right";
			vertSizing = "bottom";
			profile = "GuiDefaultProfile";
			visible = "1";
			active = "1";
			tooltipProfile = "GuiToolTipProfile";
			hovertime = "1000";
			isContainer = "1";
			canSave = "1";
			canSaveDynamicFields = "0";

		new GuiMLTextCtrl(fblock_text) {
			lineSpacing = "2";
			allowColorChars = "0";
			maxChars = "-1";
			useURLMouseCursor = "0";
			position = "3 35";
			text = %posttext;
			extent = "553 14";
			minExtent = "8 2";
			horizSizing = "right";
			vertSizing = "bottom";
			profile = "GuiMLTextProfile";
			visible = "1";
			active = "1";
			tooltipProfile = "GuiToolTipProfile";
			hovertime = "1000";
			isContainer = "0";
			canSave = "1";
			canSaveDynamicFields = "0";
		};

		new GuiMLTextCtrl(fblock_name) {
			text = %postername;
			lineSpacing = "2";
			allowColorChars = "0";
			maxChars = "-1";
			useURLMouseCursor = "0";
			position = "3 3";
			extent = "229 14";
			minExtent = "8 2";
			horizSizing = "right";
			vertSizing = "bottom";
			profile = "GuiMLTextProfile";
			visible = "1";
			active = "1";
			tooltipProfile = "GuiToolTipProfile";
			hovertime = "1000";
			isContainer = "0";
			canSave = "1";
			canSaveDynamicFields = "0";
		};
	};
   
	fpost.addGuiControl(%Fblock);
}


// ERROR //
^^^vertSizing = "bottom";

^^^profile = "GuiMLTextProfile";

^^^visible = "1";

^^^active = "1";

^^^tooltipProfile = "GuiToolTipProfile";

^^^hovertime = "1000";

^^^isContainer = "0";

^^^canSave = "1";

^^^canSaveDynamicFields = "0";

^^};

^};

   

^fpost.add(%Fblock);

##}##


>>> Error report complete.
#6
02/15/2011 (11:01 pm)
Looks like your GuiContainer is missing its };

function clientCmdaddpost(%postername, %posttext, %postid)
{
	%Fblock = new GuiControl(%postid) {
		position = "0 0";
		extent = "1024 768";
		minExtent = "8 2";
		horizSizing = "right";
		vertSizing = "bottom";
		profile = "GuiDefaultProfile";
		visible = "1";
		active = "1";
		tooltipProfile = "GuiToolTipProfile";
		hovertime = "1000";
		isContainer = "1";
		canSave = "1";
		canSaveDynamicFields = "1";

		new GuiContainer() {
			margin = "0 0 0 0";
			padding = "0 0 0 0";
			anchorTop = "1";
			anchorBottom = "0";
			anchorLeft = "1";
			anchorRight = "0";
			position = "208 342";
			extent = "558 99";
			minExtent = "8 2";
			horizSizing = "right";
			vertSizing = "bottom";
			profile = "GuiDefaultProfile";
			visible = "1";
			active = "1";
			tooltipProfile = "GuiToolTipProfile";
			hovertime = "1000";
			isContainer = "1";
			canSave = "1";
			canSaveDynamicFields = "0";

		new GuiMLTextCtrl(fblock_text) {
			lineSpacing = "2";
			allowColorChars = "0";
			maxChars = "-1";
			useURLMouseCursor = "0";
			position = "3 35";
			text = %posttext;
			extent = "553 14";
			minExtent = "8 2";
			horizSizing = "right";
			vertSizing = "bottom";
			profile = "GuiMLTextProfile";
			visible = "1";
			active = "1";
			tooltipProfile = "GuiToolTipProfile";
			hovertime = "1000";
			isContainer = "0";
			canSave = "1";
			canSaveDynamicFields = "0";
		};

		new GuiMLTextCtrl(fblock_name) {
			text = %postername;
			lineSpacing = "2";
			allowColorChars = "0";
			maxChars = "-1";
			useURLMouseCursor = "0";
			position = "3 3";
			extent = "229 14";
			minExtent = "8 2";
			horizSizing = "right";
			vertSizing = "bottom";
			profile = "GuiMLTextProfile";
			visible = "1";
			active = "1";
			tooltipProfile = "GuiToolTipProfile";
			hovertime = "1000";
			isContainer = "0";
			canSave = "1";
			canSaveDynamicFields = "0";
		};
            }; //<---- This should fix it...
	};
   
	fpost.addGuiControl(%Fblock);
}