Container Control possible?

I wonder about the efficacy of a container control for this app of mine.
I have several windows that use the same controls and they are currently a control set.
1 Can the location of controls be moved after they have been connected to a window?
2. How does it connect to a window’s methods?

controls will move if you change left,top of them.
you can define events, raise events from container control to the window.
from window methods you can access public container methods.
you can add your container controls also a interface.
you could start a test project and play with it.
you should also check if the redraw is fast enough.

You can adjust their position on the window, but you cannot move them to another window, if that’s what you mean.

You can use self.Window (or self.TrueWindow if you have containers nested in another container) to get a reference to the window. Note that this will be a generic window reference. In order to call specific methods, you would have to cast it to the correct window type. Eg.,

if self.Window isa Window1 then
    Window1(self.Window).SomeMethod
end

Alternately, you can define a class interface and implement it on all the windows you’re going to put the container in. Then you can cast self.Window to that class interface without needing to know the specifics of that particular window.

myClassInterface(self.Window).SomeMethod

I guess that would be done usually in the open statement like

OpenButton.left = 40

and the 40 would be the container’s edge.

Thanks. I wasn’t sure if it was this way or some other. I also was going to cheat and do something less.

hi Tim,

the class interface with windows caught my interest.
would you please be so kind and give me a short example how to use a classInterface with windows ? I really would like to see how it works ?

regards Johann

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.