Hello,
I’m having issue with the height="" inside xml part.
[java]
<panel height=“100%” width=“100%” align=“center” valign=“center” childLayout=“vertical” visibleToMouse=“true”>
<panel heigth=“20px” />
<panel height="" width=“100%” align=“center” valign=“center” childLayout=“horizontal” visibleToMouse=“true”>
<panel width=“20px” />
<image id=“imgPortrait” height=“100%” width="" filename=“defaultPortrait.png” imageMode=“normal” >
<effect><onCustom name=“fade” start="#00" end="#ff" neverStopRendering=“true” /></effect>
</image>
<panel width=“20px” />
</panel>
<panel heigth=“20px” />
</panel>
[/java]
I thought this part of xml should set my image in the middle of my panel with a nargin of 20 px on the top, right, bottom and left borders.
But it doesn’t do that
My image has a correct width but not a correct height ( third of the parent panel )
I don’t know if it’s the cause but I’m using it inside a control definition :
[java]
<controlDefinition name=“portrait” controller=“com.didigame.acariaempire.gui.controls.PortraitControl” >
<panel height=“100%” width=“100%” childLayout=“overlay” visibleToMouse=“true”>
<panel id=“frameBg” height=“100%” width=“100%” align=“center” valign=“center” childLayout=“center” visibleToMouse=“true”>
<image height=“100%” width=“100%” filename=“buttonPanelBG_1Col.png” imageMode=“resize:20,100,20,20,20,100,20,166,20,100,20,20” />
</panel>
<panel height=“100%” width=“100%” align=“center” valign=“center” childLayout=“vertical” visibleToMouse=“true”>
<panel heigth=“20px” />
<panel height="" width=“100%” align=“center” valign=“center” childLayout=“horizontal” visibleToMouse=“true”>
<panel width=“20px” />
<image id=“imgPortrait” height=“100%” width="*" filename=“defaultPortrait.png” imageMode=“normal” >
<effect><onCustom name=“fade” start="#00" end="#ff" neverStopRendering=“true” /></effect>
</image>
<panel width=“20px” />
</panel>
<panel heigth=“20px” />
</panel>
<panel id=“frameFg” height=“100%” width=“100%” align=“center” valign=“center” childLayout=“center” visibleToMouse=“true”>
<control type=“button” style=“buttons1Column” height=“100%” width=“100%” >
<interact onClick=“interceptClick()” />
</control>
</panel>
</panel>
</controlDefinition>
[/java]
Another way to solve my problem would be to define a center childLayout but I don’t know how to set height to “100% - 40px” XD
If someone can explain me what I’m doing wrong…
Thanks in advance !
HAH! Nice One! typing error: “heigth” instead of “height”
Just tried it and it works as you’d expect … and I was about to make up an excuse whew
The XSD validation can’t detect this as an error because Nifty elements are allowed to use arbitrary attributes.
Another solution would be to use a padding attribute btw. I think this was already available in Nifty 1.2: padding=“20px”. This works like HTML/CSS and you could have multiple (up to 4) values: padding=“20px,10px,50px,10px”.
Aaargg!!!
Silly me!
Well, on second thought, I’m glad the problem comes from my stupidity!
Thanks for seing my error