Nifty gui scrollPanel problem

Hey,

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.

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.

Could you please give me a working example, since no matter what I try I can’t make it work even with absoluteInside?

Thanks a lot!

http://hub.jmonkeyengine.org/forum/topic/unable-to-change-the-size-of-the-content-of-a-scrollpanel/

<cite>@zarch said:</cite> http://hub.jmonkeyengine.org/forum/topic/unable-to-change-the-size-of-the-content-of-a-scrollpanel/

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?

Sorry, I’ve never really used the nifty scrollpanels as I ran into some problems with them. In the end I rolled my own which gave full control.

I see, do you know how can I get into contact with the author of nifty gui?

And thanks a lot for your input!

@jadam said: Hey,

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]

[/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...
@jadam said: No, I tried it a lot of different ways (to add size to that panel) but to no avail...

Then i would remove childClip…

The author of Nifty is @void256. He’s active on these forums occasionally but sometimes it takes a while to get a response.

You can try contacting him directly through the nifty site, you should be able to find that with google.

<cite>@mifth said:</cite> Then i would remove childClip...
That is how I tried the very first time, only later I tried to add childclip here and there, but still no success...

Has anyone used scrollpanel without this problem I’m having?

<cite>@zarch said:</cite> The author of Nifty is @void256. He's active on these forums occasionally but sometimes it takes a while to get a response.

You can try contacting him directly through the nifty site, you should be able to find that with google.


Thanks, I wrote him a PM.

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

1 Like
<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.

This works for me:

[java]<control id=“infoPanelRegionConnectionsScrollPanelControl2” name=“scrollPanel” verticalScrollbar = “true” horizontalScrollbar = “true” height=“125px”>
<panel childLayout=“vertical”>
<image filename=“Textures/bgPic_bombers.jpg” />
</panel>
</control>[/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]<control id=“infoPanelRegionConnectionsScrollPanelControl2” name=“scrollPanel” verticalScrollbar = “true” horizontalScrollbar = “true” height=“125px”>
<image filename=“Textures/bgPic_bombers.jpg” />
</control>[/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: Issues · nifty-gui/nifty-gui · GitHub

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.

Do you have any idea, maybe it is a bug?

…wondering if next time you can use imgur.com like the rest of the internet and save us from all of the pop-up ads. :wink:

<cite>@pspeed said:</cite> ...wondering if next time you can use imgur.com like the rest of the internet and save us from all of the pop-up ads. ;)
Sure!

By the way, I found the problem, it was that the parent panel had childClip=true set, when I removed that it works fine…

LOL, sorry for that, hope this helps someone in the future:)

And thanks for everyone the support!

Adam.

Great that it works now :slight_smile:

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.

I’ve added an issue to the github issue tracker for Nifty: https://github.com/void256/nifty-gui/issues/138

Should be easy to fix! Thanks for (kinda) reporting that problem :slight_smile: