We have a main solution that consists of many modules. We would like to create a basic form in the main solution that can be inherited and modified by the modules. However, it appears that Servoy does not allow form inheritance outside the solution/module in which it was created (ie. no inheritance across modules). This is a problem for us, because it forces us have to duplicate forms in every module.
Should modules be able to inherit forms from the parent solution (like global variables and methods)? Can anyone suggest a better way to do what we are trying to accomplish?
I think that it’s quite logical that a child can not be depending on the parent. The other way around should work, so put your super form into a module that is on the bottom of your module tree.
I think that it’s quite logical that a child can not be depending on the parent.
Um…isn’t the parent/child relationship (ie. child inherits functionality from the parent) fundemental to object oriented programming? Despite the stress that your statement caused me, I did try your suggestion of reverse inheritance, and it worked. Go figure!
The comment I made that a child should not depend on it’s parent should be seen in the light of modules. You’re absolutely right that for inheritance, it’s vise versa.
With solutions and modules, you include child modules into the parent. So, child doesn’t know which parent it might have. Therefor, you cannot access objects from the parent inside the child modules.
Note that you should not make circular references, meaning : module A contains module B, B contains C and C contains A again. This is not considered good practice. The module structure of any solution ought to be a nice top down pyramid of modules.
Sorry for not making that more clear straight away.
pbakker:
Note that you should not make circular references, meaning : module A contains module B, B contains C and C contains A again. This is not considered good practice. The module structure of any solution ought to be a nice top down pyramid of modules.
Paul
Hi Paul,
Unfortunately I have a circular reference like you described. And I would like to solve this, by merging 2 solutions (I have module A contains module B, B contains A).
How can I merge 2 solutions into 1 solution?
There is no official support for this and as far as I know also not a feature request registered for it either.
But, you could try the following manual process in 4.0 for merging solution/module B into solution/module A, if there are no name clashes (meaning that both solutions/modules have objects of the same type and name, like both having a form called “main” for example):
Check out both solutions into your workspace
Unshare module/solution B. When using SVN/CVS: Do delete all the sharing info
Shut down your Servoy Developer
Manually copy all files and directories from module/solution B into the directory containing module/solution A, but exclude the following files:
All files in the root folder of the project, like .project, rootmetadata.obj, solution_settings.obj and globals.js
the datasources directory
Manually copy the content of globals.js from module/solution B into the globals.js file of module/solution A.
Restart your Servoy Developer
Test and if ok:
Delete module/solution B from your Repository (Important, or else you will have a clash of UUID’s when trying to commit later on)
Commit
This process should work, but I haven’t tested it yet.
Note: as said before, merge functionality is not supported and this is a way to trick the system, so make backups!