|
Autoforms: Development Talks
jstaniek, ccpasteur: july 2005
See also: Forms embedded inside Kexi: Autoform
Reusable components
^ toc
Wizard's pages
We can reuse some wizard pages from LookupColumnWizardDocs.
^ toc
Autolabels
Let editor widget be a widget which can contain editable data that usually needs a text label so user can know what (database) field it represents.
Most common editor widget types can be:
- line edit, text editor, combobox
- radio button, checkbox (see question Q1 below)
- slider
- etc...
We're going to implement autolabels as a pair label+editor_widget glued together.
There're two types of autolabels:
- horizontal (more commonly used)
[autolabel][editor]
[autolabel]
[editor ]
In fact, autolabels are not specifically tied to autoforms -- they can be used in any form type, but we have found them especially useful for creating autoforms, where labels, as other widgets, are always generated automatically.
^ toc
Other constraints
- autolabel has always editor widget set as its buddy
- either autolabel and editor widget is selectable, and each of them provides/displays it's own set of properies. Note, this is a special case within Kexi Form Designer.
- if "widgetType" property is set to "Auto" and "dataSource" is empty, the field should have present unbound "Text" editor. Thus, on inserting (design time), autolabel will look reasonably.
- On inserting, label's text should be set "Auto Field %1" text, not something like "please select valid data source". The label should be immediately in inline editing mode, just as ordinary labels are.
^ toc
Low priority constraints
- within the Object Tree panel, autolabel+editor is displayed as a parent-child pair, as shown below. Thus, a user looking at the Object Tree panel can see a difference between a widget without an autolabel and a widget with autolabel attached. She is also able to select one of them by clicking on a tree item, or select both.
+[editor name]
[autolabel name]
- autolabels reuse boolean "addColonToAutoLabels" form's property. The property is not yet implemented. It should be also added to global Kexi Project's settings. The default for new projects should be true.
- when used in design mode of ordinary form, widgets with autolabels inherit "autoLabelsMode" form's property. The possible values are { Horizontal (the default), Vertical }
- on design time, it should be possible to:
- remove autolabel without removing its editor widget
- remove editor widget without removing assigned autolabel
- use a popup menu commands "autolabel->add", "autolabel->remove"
- use a popup menu commands "autolabel->assign" if there's regular label and editor widget
^ toc
Problem with layouts and autolabels
- Horizontal autolabels have problem with label's width when groupped within a vertical_box layout or vertical_flow layout or grid layout:
-
- Vertical autolabels have problem with label's height when groupped within a horizontal_box layout or horizontal_flow layout or grid layout:
-
Proposed solution is to set the same arbitrary width for every horizontal autolabel (or height for vertical autolabel) within a layout column (or layout's row, accordingly).
^ toc
Questions
Q1: (jstaniek) This may be longer term TODO, but what about autolabels attached to checkbox/radiobuttons? I guess it can be usable to support well aligned autolabels for these widgets too, for instance ([x] stands for checkbox, (*) for radiobutton):
[name: ][line edit ]
[option1: ][x]
[option2: ][x]
[select1: ](*)
[select2: ]( )
^ ^
| |
well well
aligned aligned
labels widgets
Without using autolabels for checkbox/radiobuttons for above exmample we could have:
[name: ][line edit ]
[x][option1 ]
[x][option2 ]
(*)[select1 ]
( )[select2 ]
^ ^
| |
NOT SO WELL well
aligned aligned
labels widgets
|