Results 1 to 6 of 6

Thread: visibility and children

  1. #1
    Lesser Knight
    Join Date
    Sep 2006
    Location
    Barcelona, Catalonia
    Posts
    30

    Default visibility and children

    Hi, while using the signal "func_visibility_change" to refresh some info displayed on a GUI component I realized that changes on visibility doesn't spread to the children of the widget you've shown/hidden. Is it an intended effect?

    I'm not sure whether it could be better to call "set_visible" to the children of a component every time this function is called on the parent...what do you think?

    Cheers.

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    Its not an intended effect.

    If the parent is invisible, the children should be invisible. If the parent is made visible, the children should become visible too and they should receive a repaint request. Anything else is a bug.

  3. #3
    Lesser Knight
    Join Date
    Sep 2006
    Location
    Barcelona, Catalonia
    Posts
    30

    Default

    Hi Magnus, the problem I see is that, if you configure a gui component to have some of its sons hidden by default, when you show the parent all the children will be shown, too...I suspect that this behavior change could affect some code, but if you still think that it should be the correct one I can make a patch with the code (for set_visible as well as set_enable).

    Xavi

    Quote Originally Posted by Magnus Norddahl View Post
    Its not an intended effect.

    If the parent is invisible, the children should be invisible. If the parent is made visible, the children should become visible too and they should receive a repaint request. Anything else is a bug.

  4. #4
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    Each component has a 'visible' flag. A component is only visible if all its parents are visible and its own visible flag is set. Changing the visibility flag for a component should not change the flag for any child components.

    If you patch does it like that, then please post it. If any code breaks due to that, then that code was always broken, but I don't think it breaks any of the clanGUI standard components.

  5. #5
    Lesser Knight
    Join Date
    Sep 2006
    Location
    Barcelona, Catalonia
    Posts
    30

    Default

    So the change here would be to invoke the change visibility callback whenever a widget is visible, and all its parents are visible too, right?
    I'll try to make the patch and attach it to the thread.

    Cheers,

    Xavi

    Quote Originally Posted by Magnus Norddahl View Post
    Each component has a 'visible' flag. A component is only visible if all its parents are visible and its own visible flag is set. Changing the visibility flag for a component should not change the flag for any child components.

    If you patch does it like that, then please post it. If any code breaks due to that, then that code was always broken, but I don't think it breaks any of the clanGUI standard components.

  6. #6
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    Yes.

    Sorry if my previous posts were a bit confusing, but basically our visibility should work the same way as it does in any other GUI.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •