Component::visibilityChanged for isShowing

Hi all,
is there a listener method I can overwrite in Component to add/remove listeners when the component is showing in the window (isShowing() returns true).

The theoretic use case is for the child component to get notified in the child when it is selected in the TabbedComponent.

Would be great to get a hint into implementing this :slight_smile:

Turns out visibilityChanged works for my case. But would be still interested in other opinions :smiley:

isShowing() is true when the component is visible, all of its ancestors are visible, and the peer isn’t minimised.

ComponentListener has callbacks for visibility, and parent hierarchy, but not for minimisation. There is a virtual method on the component itself to be notified of minimisation state changes… but it’s not part of the listener.

So listening to visibility and parent hierarchy would let you know in most cases if the component is showing or not.

1 Like

Thanks! Didn’t think of listening to the hierarchy.