Form Inheritance Documentation

Does anyone know of any documentation on form inheritance and how it works and how to use it. This is all I could find.

Forms can also have methods and variables attributed to them, making form a unit of scope in Servoy programming. This means forms can have methods and variables that are within the scope of the form only. Inherited forms can also have methods and variables that are inherited from the parent form as well.

Hi Matt,

I think there’s very little documentation on this.
If you are looking for specific subject, I’d suggest you post it here.

If I’m not mistaken this is the framework which was shown by Sean Devlin at SW11: https://www.servoyforge.net/projects/servoy-commons
Although not documentation, it’s more a nice working example (maybe even better :-) )

Hope this helps.

the quick example is this (form the scripting point of view)

form base
{
       var formVariableInBase = 10;

       function myFunction() {
            formVariableInBase  = 30;
       }

       function myFunction2() {}
}

form sub (extends base)
{

       var formVariableInSub

       function myExtraFunction() {
            // i can access the base variable:
           if (formVariableInBase  == 10)
           {
                 // i can call the base functions:
                 myFunction2();
            }
       }

       // this own overrides the base function
       function myFunction() {
           // but i can call the base with the _super keyword:
           application.output(formVariableInBase); // will print 10
          _super.myFunction();
          application.output(formVariableInBase); // will print 30
       }
}

This is the pure scripting side, for they ui you just inherited the ui and you could add some more ui elements to it.
And could override certain properties of the form, In Servoy 6 we enhanced this quite a bit and now you can set/override pretty much all the properties and also all the elements of the base form can be changed in the sub form (so just for that form not changing the real base form itself)

Ok, I think that answers it. I was finally going to start implementing it for a number of good reasons but wanted to assign a parent form to one I had already created. That of course changed the form dimensions which I didn’t want even though everything else was overridden. I was thinking I might have to do that at runtime but then wanted to learn a bit more before diving right in. Just that little bit answers a lot of my questions.

Hi Matt,

Here’s a link to a form inheritance walkthrough: http://www.visualfoxpro.com/form_inheritance.aspx. For you it may be a bit trivial but maybe for others who are looking for documentation or a sample implementation it can be a step in the right direction.

Regards,
Omar van Galen

omar:
Hi Matt,

Here’s a link to a form inheritance walkthrough: http://www.visualfoxpro.com/form_inheritance.aspx. For you it may be a bit trivial but maybe for others who are looking for documentation or a sample implementation it can be a step in the right direction.

Regards,
Omar van Galen

Nice work Omar.

omar:
Hi Matt,

Here’s a link to a form inheritance walkthrough: http://www.visualfoxpro.com/form_inheritance.aspx. For you it may be a bit trivial but maybe for others who are looking for documentation or a sample implementation it can be a step in the right direction.

Regards,
Omar van Galen

Good explanation. We could use something like this in the Servoy WIKI. hint hint :)

We also have videos on it in the Form Design tutorials on ServoyUniversity.com :)