GUIScrollArea Elements


#1

Hi,

I have been playing around with GUIScrollAreas a bit.
There are 3 problems I face:

  1. I add a new Element to the GUIScrollArea after I detect an certain input. Right after adding the element, I also make sure to scroll all the way down with scrollDownPct(1.0) . But this does not seem to work. I am always one element short of being at the very bottom. I assume the layout has not properly updated with the new Element when I scroll down. What is the proper way to fix this?

  2. When adding elements to the layout of the GUISCrollArea, the elements will always try to divide the space evenly between them instead of having a fixed height each. Is changing fixedHeight to true in the style I use for the GUILabel enough?

  3. Is there a way to access an element of a GUIScrollArea (given the index)?

Regards
Bude


#2

Hi.

  1. I think this an issue, it’s best to report it on GitHub (ideally with a code example if you have one). Temporarily you might be able to fix it by calling GUIWidget::_updateLayout right after adding the new element.
  2. You don’t have to modify the style (but you can). You can use GUIElement::setHeight or provide GUIOption::fixedHeight in the constructor.
  3. You can use GUILayout::_getChild on the GUILayout returned from GUIScrollArea::getLayout(). It’s an internal method but it should work.

#3

Hi,
Thanks for the reply.

I opened an issue for no.1 here https://github.com/GameFoundry/bsf/issues/338.

For no.2 I tried with setHeight for now and it works fine. Will have to see which option I prefer…

no.3 I was aware of this function, but unsure if that is the proper way to do it. I will try it out.

btw: Is there a way to retrieve the text from a GUILabel?


#4

Not that I can tell, but it would be a useful addition. Feel free to open up an issue about it so I don’t forget.


#5

Actually I was thinking about my problem in the wrong way so retrieving the content/text from a label is not useful to me after all :smiley:
Do you still want me to open an issue?


#6

Nah, less work for me and I don’t need it myself :slight_smile: