Hi! How can i make a simple Button appear? What the is wrong? pre type="xml"
<screen id=“start” controller=“de.lessvoid.nifty.examples.helloworld.HelloWorldStartScreen”>
<layer id=“layer1” childLayout=“center”>
<panel backgroundColor="#0f4f" childLayout=“vertical” align=“center” valign=“center” width=“35%” height=“45%”>
<effect>
<onStartScreen name=“move” direction=“top” mode=“in” startDelay=“0” inherit=“true” length=“300”/>
</effect>
<text font=“Interface/Fonts/Default.fnt” align=“center” text=“Mainmenu”></text>
<text font=“Interface/Fonts/Default.fnt” align=“center” text=“Mainmenu”></text>
<control id=“button” name=“button” type=“button” align=“center” valign=“center” style=“nifty-button” childLayout=“center”/>
</panel>
</layer>
</screen>/pre
I can se both “mainmenu” but no button, nor any other control -.- These are the importantst elements of nifty-gui, aren’t they? So why its that badly documented? The tutorial-xml is buggy, the only page that could have helped(34) is empty, bc some1 renamed the controlDefinition of the dropdownControl…
are you using controlDefinitions ? im actually have the same problem as you, the 1.2 tutorial talks about it you will need to look at more complex examples to see how to use them.
1.2 tutorial : nifty-tutorial
Solved… no matter how but i finally got this code working (its the full .xml, copy content and try!):
“<useStyles filename=“nifty-default-styles.xml”/”
“<useControls filename=“nifty-default-controls.xml”/”
are the important lines. care, the order matters! and you need all nifty-jars in your projectpath (nifty, nifty-examples, nifty-default-controls etc…)
pre type="xml"
<?xml version=“1.0” encoding=“UTF-8”?>
<nifty xmlns=“http://nifty-gui.sourceforge.net/nifty.xsd”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty.xsd
http://nifty-gui.sourceforge.net/nifty.xsd”>
<useStyles filename=“nifty-default-styles.xml”/>
<useControls filename=“nifty-default-controls.xml”/>
<screen id=“start” controller=“de.lessvoid.nifty.examples.helloworld.HelloWorldStartScreen”>
<layer id=“layer1” childLayout=“center”>
<panel backgroundColor="#0f4f" childLayout=“vertical” align=“center” valign=“center” width=“35%” height=“45%”>
<effect>
<onStartScreen name=“move” direction=“left” mode=“in” startDelay=“6” inherit=“true” length=“300”/>
</effect>
<text font=“Interface/Fonts/Default.fnt” align=“center” text=“Mainmenu”></text>
<text font=“Interface/Fonts/Default.fnt” align=“center” text=“Mainmenu”></text>
<control id=“button” name=“button” type=“button” align=“center” valign=“center” style=“nifty-button” childLayout=“center”/>
<control type=“button” align=“center” >
<text font=“Interface/Fonts/Default.fnt” align=“center” text=“Mainmenu”></text>
</control>
<control type=“button” align=“center” text=“Mainmenu”>
<text font=“Interface/Fonts/Default.fnt” align=“center” text=“Mainmenu”></text>
</control>
<control type=“button” align=“center” >
<text font=“Interface/Fonts/Default.fnt” align=“center” text=“Mainmenu”></text>
</control>
<control type=“button” align=“center” >
<text font=“Interface/Fonts/Default.fnt” align=“center” text=“Mainmenu”></text>
</control>
<control type=“button” align=“center” label=“Quit” >
<text font=“Interface/Fonts/Default.fnt” align=“center” text=“Mainmenu”></text>
</control>
</panel>
</layer>
</screen>
</nifty>
/pre
aha thanks for posting that, now i can add buttons yay !