Announcement

Collapse
No announcement yet.

Contents of Scroll frame disappear at run-time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Contents of Scroll frame disappear at run-time

    Has anyone worked with UIScrollframe? I set up a scroll frame (called Panel [Scrolling Panel] in uiscene editor) in my scene with labels and editboxes and such as its children. I did the necessary Findchild functions code-side for that scene.
    Everything looks fine while setting up the scene in the uieditor. But during run-time when the scene opens up, all my contents inside the scroll frame become invisible. I made sure that the opacity for both the frame and the content widgets are 1.f, but for some reason they are just not there at run-time.
    It seems I am perfectly able to interact with the contents, but I just can't see them (things like buttons I can click and they do whatever I set them up to do).

    This is driving me crazy! Is there some bizarre function for the UIScrollFrame that by default hides its children on open that I missed? Any help will be greatly appreciated!

    #2
    [Sorry for this necro bump]

    Problem:

    I faced that problem as well. I have 3 objects in my scrolling panel placed in vertical order. Basically like this:

    Code:
    _________
    | Text  |
    | Image |
    | Text  |
    |_______|
    Everything works in the editor. I populate these text elements on runtime. I used a short text and no problem at all.
    Once I used a longer text (like Lorem Ipsum) the 2nd text object got out of the screen (not inside the visible region of the scrolling panel).

    Code:
    _________
    | Text  |
    | Image |
    |-------|
    | Text  |
    |_______|
    At this time, the scrolling frame somehow hides the text element in a special way. It still has the bHidden flag and Opacity properly set (false and 1.0). I thought the text isn't set anymore, but that was not the case.
    So I changed the first text element to have as much content that the image will be out of the scrolling region as well.

    Code:
    _________
    | Text  |
    |-------|
    | Image |
    | Text  |
    |_______|
    And... what happened? Right, the image object is not drawn anymore. AFAIK, there is no proper code function to be called in order to fix that. I tried several things like changing the visibility and so on but nothing worked out.

    So here is the strange thing, why is the first object always drawn? Right, it is always visible (=inside the visible region of the scrolling frame) so it will never get hidden. Since the srolling frame only checks for direct children (and not children's children), there is a workaround (or let me call it fix) for that problem.


    Solution:

    In order to have a working scrolling panel, you have to wrap all your elements into 1 object which is the only child of the scrolling panel. Of course you have to size the wrapping object properly so the scrolling panel can work with it and show the correct scroll bars. The schematic view would look like this:

    Code:
    _____________
    | _________ |
    | | Text  | |
    | | Image | |
    |_| Text  |_|
      | Image |
      | Text  |
      |_______| 
    As XML format:
    Code:
    <UIScrollFrame>
      <UIPanel>  
        <UILabel />
        <UIImage />
        <UILabel />
        <UIImage />
        <UILabel />
      </UIPanel> 
    </UIScrollFrame>
    In this case, the wrapping object is always visible and will never be hidden. All the inner objects won't be changed as the scrolling panel does not touch children's children.

    Comment

    Working...
    X