I often add a Property into the Child WebContainer of the Parent’s type. In the Open event of the Parent, you set the Child’s property to ‘me’. This way I can access all the methods and controls of the parent from within the child.
In the container “ctTest” I declare a public property “pparent” with the type webdialog. ctTest is embedded in the webdialog and instanciated as “ctTest1”. In the Open-Event of the webdialog I set:
ctTest1.pparent = me
In ctTest I call after a textfield ist changed:
pparent.doSomething()
When I try to debug XOJO tells me:
Type "Webdialog" has no member named "doSomething"
pparent.doSomething()
‘pparent’ should not be of generic type ‘WebDialog’, but typed as ‘WDAccounts’. Then in the Open event of WDAccounts set:
ctTest1.pparent = self
Then all your code inside ctTest1 doesn’t just know that pparent is a WebDialog, it know exactly which WebDialog it is. If WDAccounts has a method called ‘doSomething()’ then inside ctTest1 you can call pparent.doSomething().
If it is a WebContainer inside another WebContainer it needs to be adjusted, but it works too.
So the advantage to using “Select Case Self.Parent.Name” is, that I can use the dialog in different places of my project (dlg1, dlg2, dlg…) and don’t have to distinguish between the calling parent-dialogs in the embedded container.
This will work, if the parent is always the specific webdialog. Is there also a possibilty for a more common approach to cover what Greg said? “Also remember that Parent might not be a WebPage. It could be a WebDialog or another WebContainer.”