When visibility is a matter of perception

Your project might contain a number of embedded desktopContainers, the contents of which you don’t want to update if the container is not visible, example CC_c, embedded in CC_b, embedded in Window_a.

You might have hidden CC_b so that it doesn’t show in your window, but testing CC_c for visibility might show true, so you update thereby wasting time on a non-visible item.

My solution to this is to add an extended method viz:

Public Function visible_truly(extends dc as desktopContainer) As boolean
  
  //iterate until in window, if any are not visible, return not visible
  
  Var isVisible As Boolean = dc.visible
  
  While isVisible 
    
    Var P As Object = dc.Parent
    
    Select Case P
    Case IsA DesktopWindow 
      Return DesktopWindow(p).Visible
      
    Case IsA DesktopContainer
      
      If DesktopContainer(p).Visible = False Then
        Return False
        
      Else
        dc = DesktopContainer(P)
        isVisible = dc.Visible
      End If
      
    End Select
    
  Wend
  
  Return isVisible
End Function

I couldn’t see a standard solution to this but this sped up my project considerably and removed a number of hidden bugs.