How to access objects in nested containers - from the inside out?

Hello all,

Xojo 2019 R1.1 web app
I have a page( ReportAutomationPage) , inside the page is a container (ContainerReportOptions), inside that container are several objects AND another container (containerTimeSettings) that holds several objects.

On the page the ContainerReportOptions is named cntReportOptions. Inside of the ContainerReportOptions is the container containerTimeSettings named cntTimeSettings.

When one or more check boxes have a True value in cntTimeSettings, I need the chkBox.changed event to do some work. The first thing is for it to look at three check boxes in the cntReportOptions. Problem is, I cannot access these, even though the check boxes properties are set to Public.

I could put the code into the cntReportOption, but I don’t have access to the events inside of the cntTimeSettings.

If cntReportOptions.chkDelOptWeekly.Value = True Then 
      If CheckDays > 1 Then 
            chkDay(index).Value = False
            chkSelAllDays.Value = False
            MsgBox "You can only select ONE day a week for weekly Report Automation"
     End If
End If

What is the correct/best way to accomplish this?

Communicate with events. The containers don’t need to know that other containers have a checkbox. In most situations controls should be private.

You build a firewall between the containers. Neither should know anything about the other’s contents - controls, properties, etc. The outer container calls methods defined on the inner container, preferably as part of an Interface, so you can easily swap out containers. The inner container creates Event Definitions which the outer container implements Event Handlers for.

1 Like

OK, I understand now.

Thank you both!