[Cuis-dev] Dialog molding tool
Hilaire Fernandes
hfern at free.fr
Sat Apr 29 00:43:33 PDT 2023
Hi,
I have finished the first round of the package for GUI dialog molding
tool. It is a helper to build field Morph dialog and to validate user
input data.
In top of the UI-Mold package there a the test package UI-Mold-Test.
Checkout at https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-UI
Example of field descriptions and inter-field validations:
Mold dialog
Smalltalk code to describe it:
|mold fullname email confirmEmail |
mold := Mold new.
fullname := mold stringField
on: #propertyValue of: ValueHolder new;
label: 'Your Name';
beRequired;
addCondition: [:input | input includesSubString: ' ']
labeled:
[:wrong |
'Please enter your first and last name. I couldn''t find a space in {1}' format: {wrong} ].
email := mold emailField
on: #propertyValue of: ValueHolder new;
label: 'Email Address:'.
confirmEmail := mold emailField
on: #propertyValue of: ValueHolder new;
label: 'Confirm Email:'.
email
addCondition: [:input | input = confirmEmail input ]
labeled: 'Email addresses did not match.'.
confirmEmail
addCondition: [:input | input = email input ]
labeled: 'Email addresses did not match.'.
mold textField
on: #propertyValue of: ValueHolder new;
label: 'About yourself.';
beRequired.
mold checkboxField
on: #propertyValue of: (ValueHolder with: true);
label: 'Sign for the newsletter';
addCondition: [:input | fullname isValid not or: [input or: [fullname value first = $K ] ] ]
labeled: 'Sorry, you may not opt out of our spam unless your name starts with K.'.
mold openDialog: 'Example Eight'
--
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230429/b0c0fc99/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture d??cran de 2023-04-29 09-14-05.png
Type: image/png
Size: 40982 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230429/b0c0fc99/attachment-0001.png>
More information about the Cuis-dev
mailing list