Nifty Gui – BackgroundImage?

I started with gui Creation some days ago… and i dont know. Am i too stupid? :frowning:

First of all our little code snippet:

[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”>

<screen id=“start” controller=“de.lessvoid.nifty.examples.helloworld.HelloWorldStartScreen”>

<layer childLayout=“center” backgroundImage=“assets/Interface/MainMenu.jpeg”>

<panel backgroundColor="#000033" childLayout=“center” height=“100%” width=“100%” align=“center” valign=“center”>

<control id=“submitButton” type=“button” label=“submit!”>

</control>

</panel>

</layer>

</screen>

</nifty>

[/xml]

Seems valid to me… The image exists (and is in this folder only for testing purpose… i will move it later on :wink: )

Now… What is shown?

Nothing. A gray screen. I use the MonkeyPlatform to edit my GUI… I’m going crazy. I dont know, but I’m just too stupid for nifty. -.-"

Is there a error in my code… or better: Where is the error in my code? I’m quite new to nifty gui, so i beg for your pardon. >_<







@Momoko: I tried it without the “asset/” but it wouldnt work.

Maybe try the path without the “assets/” ?

Nothing. A gray screen.


well u try to see the result of ur xml-code by viewing in the "Design" tab? that didnt work for me since alpha-4 ^^
try it out within a simpleApplication! a bit annyoing...but there it should work

and "assets" should be deleted, like momoko-fan mentioned

for references :
http://hub.jmonkeyengine.org/groups/gui/forum/topic/get-nifty-screencontroller-to-work/

greetings
Terry

Well.

The “asset/” thing helped for sure. Thanks a lot. I would have searched a lot for THAT one… The other problems were solved by trial and error for 2 hours. :slight_smile: But in the end it works. Thats all what counts.

Thanks a lot you two. :slight_smile:





Oh great.

I think nifty tries to render me mad.



I got it to work and made some research concerning Controls, since i read the label-element was removed.

I found everything needed… so i thought.



[xml]<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” />[/xml]



Should handle the job, so i thought.

But i cant use controls it seems. I’m really freaking out. -.-"



[xml]<layer id=“Layer Left” backgroundImage=“Interface/MeinMenu.jpeg” childLayout=“center”>

<panel height=“100%” width=“100%” childLayout=“vertical” visibleToMouse=“true”>

<panel width=“27%” height=“100%” backgroundColor="#EEEEEE0A">

<control name=“label” text=“A Label” align=“left” textHAlign=“left” width=“130px” />

</panel>

</panel>

</layer>[/xml]



This is the essential part. It works as long as i delete the line

[xml] <control name=“label” text=“A Label” align=“left” textHAlign=“left” width=“130px” />[/xml]



Anyone any ideas? I’m getting rly tired of trial and error…

What does “not working” do exactly?

It shows a gray plane if i have the line, the correct way if i remove it.

If asked for i could upload screenshots, but its not much to see. :wink:

And you don’t get any sort of errors on the console output?

1 Like

There was no error message until i changed some patterns in my testenviroment.

After that a error popped up which made very clear whats wrong;



The panel had no childLayout and that was, why the Niftyinterpreter aborted the interpreting.



To correct the Code all i had to do was to add a damned childLayout to the panel containing the control… God damn. Nowhere stood i would have to define a childLayout to every container. sigh



The easiest problems are the hardest to solve.

Thank you very much.



So much time wasted with to complex thoughts about such an error. i could bite my own … well. You know what i mean :wink: