ContainerControl
From REALbasicWiki
| Overall article skill | ✭ |
A ContainerControl represents a view embeddable into a Window or another ContainerControl. It can contain other controls or ContainerControls.
[edit] More on methods
| |||||
|---|---|---|---|---|---|
| Available on | | ||||
| General | |||||
| Superclass | Window | ||||
| Interfaces | none | ||||
| Constants | |||||
| Methods | |||||
| |||||
| Properties | |||||
| |||||
| Events | |||||
| |||||
|
NOTE: You can get descriptions of the items above from the REALbasic documentation. | |||||
The Open event handler of a ContainerControl is not called until the container is actually embedded into some other object. If you need to execute code when a ContainerControl is created, you can add a constructor to the class.
The Restore event handler is never called.
[edit] Get the containing window of a ContainerControl
The Window property of a ContainerControl embedded in another ContainerControl returns a reference to the parent container. Sometimes you actually need a reference to the containing window. For example, Window.ShowModalWithin crashes when you pass a ContainerControl reference (as of REALbasic 2008r2). Here is a function to get the parent window.
Function ParentWindow(extends c as ContainerControl) As Window
dim w as Window = c.Window
do
if w IsA ContainerControl then
w = ContainerControl(w).Window
else
exit
end if
loop
return w
End Function
