while using the scrollpanel to display only a portion of a bigger panel at a time, I’m having a problem that it does not clip its child panel element: the entire child panel is visible (outside the scrollpanel control as well).
Here is how I use the scrollpanel:
[java]
<control id=“infoPanelRegionConnectionsScrollPanelControl2” childClip=“true” name=“scrollPanel” verticalScrollbar = “true” horizontalScrollbar = “true” height=“125px”>
<panel childClip = “true” childLayout=“vertical”>
<image childClip = “true” filename=“Textures/bgPic_bombers.jpg” />
</panel>
</control>[/java]
And I can’t make it clip its child panel. Is it WAD or am I missing something? What is the way of displaying only a portion of a big panel at a time with Nifty gui?
One of the childlayout modes is called something like AbsoluteInside. That means you position absolutely and anything that extends outside the panel with that layout set gets cropped.
In that example you circumvented the usage of a scrollPanel by using scrollbar. I’d prefer not having to change to a scrollbar if possible. Can you suggest, please, what can be wrong with my XML example, why is that simple scrollpanel example not working as I’d think it should work?
while using the scrollpanel to display only a portion of a bigger panel at a time, I’m having a problem that it does not clip its child panel element: the entire child panel is visible (outside the scrollpanel control as well).
Here is how I use the scrollpanel:
[java]
<control id=“infoPanelRegionConnectionsScrollPanelControl2” childClip=“true” name=“scrollPanel” verticalScrollbar = “true” horizontalScrollbar = “true” height=“125px”>
<panel childClip = “true” childLayout=“vertical”>
<image childClip = “true” filename=“Textures/bgPic_bombers.jpg” />
</panel>
</control>[/java]
And I can’t make it clip its child panel. Is it WAD or am I missing something? What is the way of displaying only a portion of a big panel at a time with Nifty gui?
Thanis in advance,
Adam.
If you add size for the panel will it help you?
[java]
<cite>@mifth said:</cite>
If you add size for the panel will it help you?
[java]
<panel childClip = “true” childLayout=”vertical” width=500px height=500px>
[/java]
No, I tried it a lot of different ways (to add size to that panel) but to no avail...
Don’t set the childClip attribute when you use the control since this is already handled by Nifty inside the controlDefintion (the childClip has to be applied to the right internal panel the control provides). In fact you can remove all of the childClip attributes from all of the elements in your example.
This works for me:
[java]
[/java]
If you only want to display the image and you don’t need that inner panel for some other purpose you could remove that as well:
[java]
[/java]
And a general note on Nifty support: Since here (jme forum) are a lot of experienced and helpful Nifty users you’ve come to the right place to ask questions, I think. If you found something that looks like a bug or you can’t solve that with the help of them feel free to create a new issue on github: https://github.com/void256/nifty-gui/issues
<cite>@void256 said:</cite>
Don't set the childClip attribute when you use the control since this is already handled by Nifty inside the controlDefintion (the childClip has to be applied to the right internal panel the control provides). In fact you can remove all of the childClip attributes from all of the elements in your example.
And a general note on Nifty support: Since here (jme forum) are a lot of experienced and helpful Nifty users you’ve come to the right place to ask questions, I think. If you found something that looks like a bug or you can’t solve that with the help of them feel free to create a new issue on github: https://github.com/void256/nifty-gui/issues
Hi,
first of all thanks for you kind reply and help!
I’ve uploaded a screenshot to let you see my problem, as it is somewhat hard to explain only using words: here
So for some reason no matter what parameters I set for that encircled scrollPanel, it just does not clip the image’s parts outside of it. Rather it seems that instead of the scrollPanel the scrollPanel’s parent panel is what is used for clipping the image within the scrollPanel. This is really strange and so far none of the ideas worked for me.
I think this is a bug though. It should be possible to further restrict a childClip element when a child element specifies a childClip=“true”. Looking into the code I can confirm that Nifty does not handle that properly right now. At the moment you can’t restrict the clipping rectangle further.