Form Inheritence?

Forum to discuss the new web client version of Servoy.

Form Inheritence?

Postby john1598360627 » Thu Jun 02, 2022 1:16 am

INHERITANCE
To make it easier to deploy general features, I wanted to create template forms that I could expand upon. Essentially, the exact same way Inheritance works in Object Oriented Programming.

https://link.springer.com/chapter/10.1007/978-1-4302-0202-8_6
Inheritance allows you to create class hierarchies, where a base class gives its behavior and attributes to a derived class. You are then free to modify or extend its functionality.


By creating my 'class' form, I want to derive this class into a new form. Then, modify different aspects so it's a unique object. These changes would be both Frontend and Backend. This would mean all these would share a similar element, making it easy to add a new feature to everything, but also to have unique code and elements for every page.


EXTENDFORM
I looked into if Servoy can do this. There seems to be an 'extendForm' feature, but I'm confused on how to use it. I found this wiki talking about an 'Inheritance Model';

https://wiki.servoy.com/display/Serv7/Inheritance+Model

This is from Servoy 7. It talks about extending a form. But also, 'Overwrite Methods'. Overriding the existing code in the class. Which seems to be by calling the 'superform'. This is by calling the super with '_super'.


CURRENT?
This guide was from Servoy 7, but I'm not sure if this process has changed it all in the current version of Servoy. Is it OK to still use this? Or is it being deprecated or changed in Titanium.

Also is there a guide on how to use it now if has been updated?
john1598360627
 
Posts: 169
Joined: Tue Aug 25, 2020 3:03 pm

Re: Form Inheritence?

Postby mboegem » Thu Jun 02, 2022 10:56 am

Hi John,

extending a form is still the same.

some comment on using functions from the parent form:
As long as functions (methods) have been tagged with @public or @protected, you will be able to choose these from a child form.
In case you want to extend code on the child form, you just create a function with the same name.
Within that function you can call _super.myFunction to call functions on the parent form.

Hope this helps a bit more
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Form Inheritence?

Postby john1598360627 » Thu Jun 02, 2022 10:52 pm

mboegem wrote:Hi John,

extending a form is still the same.

some comment on using functions from the parent form:
As long as functions (methods) have been tagged with @public or @protected, you will be able to choose these from a child form.
In case you want to extend code on the child form, you just create a function with the same name.
Within that function you can call _super.myFunction to call functions on the parent form.

Hope this helps a bit more

Alrighty! Thanks!


And just to be clear, this feature isn't being removed any time soon right? If I convert my whole project into using this, it won't all disappear in Titanium, correct? Just making sure before I start applying this everywhere.
john1598360627
 
Posts: 169
Joined: Tue Aug 25, 2020 3:03 pm

Re: Form Inheritence?

Postby mboegem » Fri Jun 03, 2022 10:40 am

mboegem wrote:And just to be clear, this feature isn't being removed any time soon right? If I convert my whole project into using this, it won't all disappear in Titanium, correct? Just making sure before I start applying this everywhere.


Well, this answer is up to Servoy.
Titanium is "no more" than current NG on Angular (instead of AngularJS)
I'd expect most applications to break if this would be discontinued and I don't see why it should be.
Considering everything I know, I wouldn't hesitate to use it.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Form Inheritence?

Postby sean » Wed Jun 22, 2022 3:09 pm

Marc is correct. FOrm inheritance is not affected by Titanium and has core support in Servoy.
Software Engineer
Servoy USA
sean
 
Posts: 370
Joined: Mon May 21, 2007 6:26 pm
Location: USA


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 4 guests