NiftyGUI Label Xml Failure

Hello everyone, I updated to Nifty 1.3 and I’m trying to get up to speed with the changes. I’ve read a lot (all?) of the material at the niftyGui website and a lot of topics here at jmonkeyengine and I’m not able to find the solutions to my problem. Label control isn’t working for me. Here is my xml definition I’m using:



[xml]<control name=“label” text=" " height=“2%” width=“10%” align=“center” />[/xml]



But is generating this error:



[java]WARNING: controlDefinition [label] missing.

java.util.NoSuchElementException

at java.util.AbstractList$Itr.next(AbstractList.java:350)

at de.lessvoid.nifty.loaderv2.types.ControlType.makeFlatControlsInternal(ControlType.java:67)

at de.lessvoid.nifty.loaderv2.types.ElementType.makeFlatControls(ElementType.java:330)

at de.lessvoid.nifty.loaderv2.types.ElementType.makeFlatControls(ElementType.java:328)

at de.lessvoid.nifty.loaderv2.types.ElementType.makeFlatControls(ElementType.java:328)

at de.lessvoid.nifty.loaderv2.types.ElementType.prepare(ElementType.java:288)

at de.lessvoid.nifty.loaderv2.types.ScreenType.create(ScreenType.java:64)

at de.lessvoid.nifty.loaderv2.types.NiftyType.create(NiftyType.java:137)

at de.lessvoid.nifty.Nifty.loadFromFile(Nifty.java:435)

at de.lessvoid.nifty.Nifty.fromXml(Nifty.java:336)[/java]



I’m not sure if I’m doing anything wrong here–or if this is a 1.3 bug.

I should also mention that my ns declaration for my xml file is this:



[xml]<nifty xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance

xsi:noNamespaceSchemaLocation=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd”>[/xml]



Hmm. The above xml snippet isn’t displaying what I pasted in.

This is the ns declaration as I’m using it:



[java]

<nifty xmlns=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance

xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd”>

[/java]



and this is my labe declaration:

[xml]

<control name=“label” text="Name: " align=“left” textHAlign=“left” width=“130px” />

[/xml]



For me, this works like a charm.



Hhmmzz… my ns isn’t displaying correct either…

Well, you can find the complete nifty xml I pasted it from here:

nify xml

Pandaemonium said:
Hello everyone, I updated to Nifty 1.3 and I'm trying to get up to speed with the changes. I've read a lot (all?) of the material at the niftyGui website and a lot of topics here at jmonkeyengine and I'm not able to find the solutions to my problem. Label control isn't working for me. Here is my xml definition I'm using:

[xml]&lt;control name=&quot;label&quot; text=&quot; &quot; height=&quot;2%&quot; width=&quot;10%&quot; align=&quot;center&quot; /&gt;[/xml]

But is generating this error:

[java]WARNING: controlDefinition [label] missing.
java.util.NoSuchElementException
at java.util.AbstractList$Itr.next(AbstractList.java:350)
at de.lessvoid.nifty.loaderv2.types.ControlType.makeFlatControlsInternal(ControlType.java:67)
at de.lessvoid.nifty.loaderv2.types.ElementType.makeFlatControls(ElementType.java:330)
at de.lessvoid.nifty.loaderv2.types.ElementType.makeFlatControls(ElementType.java:328)
at de.lessvoid.nifty.loaderv2.types.ElementType.makeFlatControls(ElementType.java:328)
at de.lessvoid.nifty.loaderv2.types.ElementType.prepare(ElementType.java:288)
at de.lessvoid.nifty.loaderv2.types.ScreenType.create(ScreenType.java:64)
at de.lessvoid.nifty.loaderv2.types.NiftyType.create(NiftyType.java:137)
at de.lessvoid.nifty.Nifty.loadFromFile(Nifty.java:435)
at de.lessvoid.nifty.Nifty.fromXml(Nifty.java:336)[/java]

I'm not sure if I'm doing anything wrong here--or if this is a 1.3 bug.


Make sure you add an id="some_label_id" in your XML. That should help.

ractoc, that link you pasted helped me solve the problem! I updated my namespace declaration but it still didn’t work…however, it worked once I added these lines:



[xml]<useStyles filename=“nifty-default-styles.xml” />

<useControls filename=“nifty-default-controls.xml” />[/xml]



This is very important! The default style is important so you can see the labels and the default controls is important so you can use controls. From all the docs I read, it wasn’t clear that I needed such lines.



madjack, I believe an id for a control is only necessary if it’s going to utiltize the EventBus. If you use a control label without an id, I believe the usage then is just a normal label, which would be equivalent to using the txt element.



Thanks everyone. Back to work…

As a side question, does anyone know which custom controls I get when I put this line in?



[xml]<useControls filename="configuration/nifty/ractoc-custom-controls.xml" />

[/xml]

Guess I pasted my question to hastily, it seems you get a message box and chat control when you use the ractoc-custom-controls.xml

Yeah, those I created myself for my own project. I am currently working on making the chat control more open though so you guys can benefit from that one as well. I even have VOID considering adding it to Nifty default controls once it’s done.

That’d be great. The chat control would be pretty handy for sure.

yeah, slowly getting there. After that I’ll prolly rework the message box to work with the new builders. This would remove the need for the placeholder panel in the xml.

Ok, chat update…

hhmmzz… might be better to make a separate topic for this one.



Well, anyways, Chat is now almost fully functioning, I got the possibility to add a player to the room, and the possibility to send a message to the room. Next up, removing someone from the room. Then a first alpha release can be made by cleaning up the code (a lot) and sending it to Void.



For the beta version, I plan on having custom pop-up commands which can be added to the members in the list. This can be useful for private chat and member info for instance. no idea yet how to make that happen in a decent way though.