Field classes

Hi All,

I’d like to know if Servoy is planning to implement field level of inheritance as opposed to form inheritance which it has now.
Or perhaps there is a way to achieve what I need in existing Servoy?
Say, there is a hundred fields in my application that use the same behaviour such as ‘select the field contents onFocusGained’. In terms of maintenance going through all fields and setting the appropriate method on them would be a terrible solution.
A similar story with my date fields: if I were to implement certain behaviour I’d have to go through all of them.

I don’t like the idea of having a base field on a dedicated form that can be extended and/or re-used wherever needed because I’d have to change the datasource of that form if I place it on other forms based on different tables. That would be a mess.

Would anyone have suggestions of how this can be elegantly done in Servoy?
Is it on Servoy to-do list?
Can it be achieved if I modify Servoy source code?

Cheers,
Maria

A solution which works for us: we have a “base” form which is not based on any table and it implements callbacks for some of the form-level events. For example, you can implement a handler for the onElementFocusedGained/Lost event which has some common behavior. The “regular” application forms then extend the base form inheriting the common behavior and they are based on the specific tables which you need.

Hi Maria,

One option you have right now is using Templates: they allow you to “configure” elements and store then under Templates in Resources and then place then on your form when needed. Difference with inheritance is that of you have already placed the “template” on forms ten times and then you edit the template, the already existing placements of the templates will not adjust (hence it’s called “Templates”).

Adding element inheritance is something that has already been requested, but isn’t scheduled to be added to the product right now.

Of course, you can modify the Servoy Source code to implement this (that is how we would do it as well), but it’s not a trivial thing to do.

FYI: to select the content of a field when it’s focused, you do not need to utilize onFocusGained methods and do you own coding: just chekc the “selectOnenter” property on the field and the behavior is taken care of by Servoy.

Paul

Thanks guys.
Very much appreciated.

Maria