[Nifty] getConstraintWidth –> pixel size -- Error of my part xD


I have a panel defined like that :


<panel id=“mainPanel” height=“100%” width=“100%” childLayout=“overlay” visibleToMouse=“true” />


And i want to retrieve it’s height and width in pixel.


element.getWidth() = 0

element.getConstraintWidth() = “100%”

element.getHeight() = 0

element.getConstraintHeight() = “100%”


How do I get it’s actual size ?

( I think I saw something about that in the forum one month ago but I can’t find it. Sorry for the double post if it’s the case xD )

Thanks in advance

element.getWidth() and element.getHeight() should return the actual size! It’s odd that it does not work in your case. What childLayout does the parent panel use? Is this a regular panel or is this part of some dynamic element or something?

What helps sometimes is to log the Nifty screen. There is a screen.debugOutput() method that returns a String that shows the complete tree of all elements and their width/height/properties/you name it :slight_smile: This might help in tracking down the issue, I think.

My bad. It works :stuck_out_tongue:

Thanks for giving me the tip of screen.debugOutput(), it will help me a lot.

Don’t know why I thought that. Perhaps the time I tried to do it there was a problem but not anymore… Sorry xD

It was for creating multiline texts but it seems you have done something about that.

I will create an other post if I still have problem with Nifty 1.3.

( I tried to simply use nifty1.3-SNAPSHOT with JME3 nightly build ut it doesn’t work, so I will wait for JME to create a nightly build with JME3 before testing that again. )