I am looking to contrive a robust FORM DESIGN TOOL to help with setting up
forms in 4D’s form editor. My plan is to run the tool while having design mode
accessible. That is easy.
How I envision it working is that I use the tool to choose what things I want
to ‘copy’ (after it is created by the tool) and then I can paste it into a FORM
in design mode.
While dynamic forms are quite tantalizing, the inability to WYSIWYG - design
them is frustrating, also considering that the ‘script’ for an object can only
be a method name, not actual script code.
However, dynamic forms could help with creating these interface elements
(displaying them in a subform) very easily, as demonstrated in 4D’s HDI JSON
DEFINITION TOOL.
Here’s what I’ve done so far:
Using the structure information gained from:
TABLES — ds[ ] .getInfo( ) — gets .name, .primaryKey, .tableNumber
— GET TABLE PROPERTIES ( ) .invisible .trigSaveNew
.trigSaveRec .trigDelRec {table info is not as helpful for making interface
objects, but…}
FIELDS — ds[dClass][attributeName] (these are in “”) — .autoFilled
.fieldNumber .fieldType .indexed .keywordIndexed .kind .mandatory .name
.readOnly .type (string) .unique
I made a “RULES” system. It is all stored inside one table with a recursive
structure (Fields ‘belong’ to Tables) and using OBJECT FIELD to store the
details.
In addition to the attributes retrieved from the Structure, I add additional
attributes for each item.
So for FIELDS, I added attributes such as the following:
.label .displayFilter .entryFilter .choiceList (name, I have a neat
auto-choiceList system too) .datumType (Phone, Dollars, etc) .fk_UIType (the
type of user-interface object to use)
I will add additional attributes as I flesh it out.
The idea is that, with the tool, I could select which fields I want to place
onto the FORM (design form editor), ‘hit a button’ and then the definition is
on the clipboard for all of those.
Thereafter I can go to the form in the design form editor, “PASTE” and those
elements are pasted onto the form.
Doing this, I can auto-setup such things as:
LABEL - Element combinations;
CBOX / POPUP / whatever other options;
[] CHECKBOX (with title taken from ‘Label’ attribute)
etc.
One of my pet peeves with 4D’s form designer is that I spend so much time
making these individually (even copy/change attributes) that it becomes a
chore.
The FORM DESIGN TOOL will already have all that it needs to know to make the
interface elements for each field. They will be positioned relative to each
other in a consistent way, and I can just bump them into place.
——
So my main question is:
Is it possible to COPY Interface Elements and then PASTE them into 4D’s FORM
EDITOR?
My idea is to:
1) have a subform on the FORM DESIGN TOOL that uses FORM DATA (i.e.
instant-generated code by the FORM DESIGN TOOL).
I pick the TABLE I am working with, which gives me all the FIELDS in a
listBox. [related tables is easy to facilitate too].
2) I select the FIELD ITEMS I want to ‘copy’
3) Then when I ‘click the button’:
4) FORM DESIGN TOOL composites a Form Object complete with all the settings
needed (shout out to 4D’s “JSON DEFINITION TOOL” HDI).
• the object name is standardized;
• the data source is automatically set;
• the other aspects of the objects are set according to ’the rules’;
• the Label TEXT objects are in place.
• the input areas are sized to what is specified in the FORM DESIGN
TOOL rather than some random dimension; then I don’t have to fuss a lot with
sizing stuff.
• even the SCRIPT can be put in place; perhaps with parameters and
everything to ‘customize’ it
5) The FORM DESIGN TOOL displays these elements in its SUBFORM. Now the
elements appear (probably in a column, with LABEL OBJECT style).
6) … now I need to be able to ‘COPY’ these in a format that can be PASTED in
4D’s Form Editor.
The weak link, I think, is that CLIPBOARD stuff. HOW DO I COPY THESE IN A
FORMAT THAT CAN BE PASTED IN 4D’S FORM EDITOR ?
Of course, if this is impossible, then I’M stuck!
Thanks for any suggestions
— Chris Belanger
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************