Is this possible? - Loading a Window into a Form - CW11

I have designed a window that displays statistics - it consists of a list box and 2 buttons.

I now wish to embed it into a number of update forms used throughout my app.

This window when called will take on values based on the particular form calling it.

Is this possible? If it is, could you please give me some pointers on how I can achieve this.

I don’t simply want to replicate the window over and over in the actual forms - because when the functionality changes (and it will) - I will have so many areas to change throughout the app.

Thank you for your assistance

1 Like

That was covered recently in Donut Holes by Dries Driessen as part of CIDC 2020 Africa which I think you can still buy

You get his complete code classes and templates to handle it all. It involved making the your Stats window a Child window that is hosted by your other windows as Owner windows.

1 Like

Another method is to write a class that creates the controls dynamically. Then in each procedure where you want to have these controls displayed on the window, instantiate an instance of the class and pass in where you want it to create the controls, etc.

1 Like

There’s a PROCEDURE template type called “UserControl” which will generate an object that can be re-used via a control template onto other windows. It’s not 100% baked, and not documented (that I know of), but it’s there.

Many years back, I sent this demo to SV, thinking it would be a cool thing to be able to do, and I think that’s where UserControl came from. (4.3 KB)

Here is a very basic example that I created to test UserControl, but it doesn’t do much. (Hope it’s the right one)

1 Like

Hi Jeff

we have a new control class under construct for use later this year.

Its a bit radical but will send you some info when its up and running.

It is designed to plug into the latest version of our C++ runtime.