WebContainer parent

I am trying to come up with a method equivalent to desktop ContainerControl.TrueWindow :

dim w as webcontainer = self while w.parent <> nil system.debuglog(w.parent.name) w = w.parent wend

The code is in a button on a container control within two successive WebContainers, finally placed as an instance on a WebPage.

So the parent should be a container control. I get an error :

[quote]Type mismatch error. Expected WebContainer, but got class WebView.
w = w.parent[/quote]

There is no WebView whatsoever in the project. It looks very much like a bug, does it not ?

I don’t understand, this works fine :

system.debuglog(self.parent.name) system.debuglog(self.parent.parent.name) system.debuglog(self.parent.parent.parent.name)

Webpage, WebContainer and WebDialog are all subclasses of WebView, which is a subclass of WebObject. WebControl is also a subclass of WebObject.

Correction. WebView inherits from WebControl.

You should be able to look at the Page property though (although it may not be set for dynamically created controls).

[quote=181316:@Greg O’Lone]Webpage, WebContainer and WebDialog are all subclasses of WebView, which is a subclass of WebObject. WebControl is also a subclass of WebObject.

Correction. WebView inherits from WebControl.[/quote]

Thank you. Now it works great with

dim w as WebView = self while w.parent <> nil system.debuglog(w.parent.name) w = w.parent wend

:slight_smile: