<div dir="ltr">This looks interesting and quite useful! I'm thinking though that input validation is such a common need that TextModelMorph should support it. I think I've worked out the details of how it can be easily done. I tested my approach by creating subclasses of TextModelMorph and InnerTextMorph, but what I did in those subclasses could just as well go into their superclasses. It would enable code like this in order to create a text input that only accepts entry of an integer up to 5 characters. The important parts are in red.<div><br></div><div><font face="monospace">entry := TextModelMorph withText: ''<br> acceptOnAny: true;<br> hideScrollBarsIndefinitely;<br> <font color="#ff0000">"Don't allow more than five characters."<br> <span style="background-color:rgb(255,255,255)">maxSize: 5</span>;<br> "Only allow digits."<br> charValidationBlock: [ :char | char isDigit ];</font><br> "Setting height to zero causes it to use minimum height for one line."<br> morphExtent: 100 @ 0;<br> <font color="#ff0000">"Don't allow the first character to be zero."<br> valueValidationBlock: [ :value | value first ~= $0 ];</font><br> wrapFlag: false.</font><br></div><div><font face="monospace"><br></font></div><div><font face="arial, sans-serif">If there is interest in this, I will provide a changeset. Otherwise I can just use my custom subclasses.</font></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, Apr 5, 2025 at 1:10 AM Hilaire Fernandes via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><u></u>
<div bgcolor="#FFFFFF">
<p><font size="4">Hi Mark, <br>
</font></p>
<p><font size="4">In the Cuis-Smalltalk-UI, you can find the Mold
system a general system for input validation. It does not need
to specialize Widget for validation, it uses external classes to
do so.</font></p>
<p></p>
<div style="background:repeat rgb(255,255,255);overflow:auto;width:auto;border-style:solid;border-color:gray;border-width:0.1em 0.1em 0.1em 0.8em;padding:0.1em 0.6em">
<table>
<tbody>
<tr>
<td>
<pre style="margin:0px;line-height:125%"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36</pre>
</td>
<td>
<pre style="margin:0px;line-height:125%"><span style="color:rgb(0,102,187);font-weight:bold">MoldExample>>eight</span>
<span style="color:rgb(136,136,136)">"</span>
<span style="color:rgb(136,136,136)"> MoldExample eight</span>
<span style="color:rgb(136,136,136)">"</span>
<span style="color:rgb(51,51,51)">|</span><span style="color:rgb(153,102,51)"> mold fullname email confirmEmail </span><span style="color:rgb(51,51,51)">|</span>
<span style="color:rgb(153,102,51)">mold</span> <span style="color:rgb(51,51,51)">:=</span> <span style="color:rgb(187,0,102);font-weight:bold">Mold</span> <span style="color:rgb(0,112,32)">new</span>.
<span style="color:rgb(153,102,51)">fullname</span> <span style="color:rgb(51,51,51)">:=</span> <span style="color:rgb(153,102,51)">mold</span> <span style="color:rgb(0,102,187);font-weight:bold">stringField</span>
<span style="color:rgb(0,102,187);font-weight:bold">on:</span> <span style="color:rgb(170,102,0)">#propertyValue</span> <span style="color:rgb(0,102,187);font-weight:bold">of:</span> <span style="color:rgb(187,0,102);font-weight:bold">ValueHolder</span> <span style="color:rgb(0,112,32)">new</span>;
<span style="color:rgb(0,102,187);font-weight:bold">label:</span> <span style="background-color:rgb(255,240,240)">'Your Name'</span>;
<span style="color:rgb(0,102,187);font-weight:bold">beRequired</span>;
<span style="color:rgb(0,102,187);font-weight:bold">addCondition:</span> [ <span style="color:rgb(51,51,51)">:</span><span style="color:rgb(153,102,51)">input</span> <span style="color:rgb(51,51,51)">|</span> <span style="color:rgb(153,102,51)">input</span> <span style="color:rgb(0,102,187);font-weight:bold">includesSubString:</span> <span style="background-color:rgb(255,240,240)">' '</span>]
<span style="color:rgb(0,102,187);font-weight:bold">labeled:</span>
[ <span style="color:rgb(51,51,51)">:</span><span style="color:rgb(153,102,51)">wrong</span> <span style="color:rgb(51,51,51)">|</span>
<span style="background-color:rgb(255,240,240)">'Please enter your first and last name. I couldn''t find a space in {1}'</span> <span style="color:rgb(0,102,187);font-weight:bold">format:</span> {<span style="color:rgb(153,102,51)">wrong</span>} ].
<span style="color:rgb(153,102,51)">email</span> <span style="color:rgb(51,51,51)">:=</span> <span style="color:rgb(153,102,51)">mold</span> <span style="color:rgb(0,102,187);font-weight:bold">emailField</span>
<span style="color:rgb(0,102,187);font-weight:bold">on:</span> <span style="color:rgb(170,102,0)">#propertyValue</span> <span style="color:rgb(0,102,187);font-weight:bold">of:</span> <span style="color:rgb(187,0,102);font-weight:bold">ValueHolder</span> <span style="color:rgb(0,112,32)">new</span>;
<span style="color:rgb(0,102,187);font-weight:bold">label:</span> <span style="background-color:rgb(255,240,240)">'Email Address:'</span>.
<span style="color:rgb(153,102,51)">confirmEmail</span> <span style="color:rgb(51,51,51)">:=</span> <span style="color:rgb(153,102,51)">mold</span> <span style="color:rgb(0,102,187);font-weight:bold">emailField</span>
<span style="color:rgb(0,102,187);font-weight:bold">on:</span> <span style="color:rgb(170,102,0)">#propertyValue</span> <span style="color:rgb(0,102,187);font-weight:bold">of:</span> <span style="color:rgb(187,0,102);font-weight:bold">ValueHolder</span> <span style="color:rgb(0,112,32)">new</span>;
<span style="color:rgb(0,102,187);font-weight:bold">label:</span> <span style="background-color:rgb(255,240,240)">'Confirm Email:'</span>.
<span style="color:rgb(153,102,51)">email</span>
<span style="color:rgb(0,102,187);font-weight:bold">addCondition:</span> [ <span style="color:rgb(51,51,51)">:</span><span style="color:rgb(153,102,51)">input</span> <span style="color:rgb(51,51,51)">|</span> <span style="color:rgb(153,102,51)">input</span> <span style="color:rgb(0,102,187);font-weight:bold">=</span> <span style="color:rgb(153,102,51)">confirmEmail</span> <span style="color:rgb(0,102,187);font-weight:bold">input</span> ]
<span style="color:rgb(0,102,187);font-weight:bold">labeled:</span> <span style="background-color:rgb(255,240,240)">'Email addresses did not match.'</span>.
<span style="color:rgb(153,102,51)">confirmEmail</span>
<span style="color:rgb(0,102,187);font-weight:bold">addCondition:</span> [ <span style="color:rgb(51,51,51)">:</span><span style="color:rgb(153,102,51)">input</span> <span style="color:rgb(51,51,51)">|</span> <span style="color:rgb(153,102,51)">input</span> <span style="color:rgb(0,102,187);font-weight:bold">=</span> <span style="color:rgb(153,102,51)">email</span> <span style="color:rgb(0,102,187);font-weight:bold">input</span> ]
<span style="color:rgb(0,102,187);font-weight:bold">labeled:</span> <span style="background-color:rgb(255,240,240)">'Email addresses did not match.'</span>.
<span style="color:rgb(153,102,51)">mold</span> <span style="color:rgb(0,102,187);font-weight:bold">textField</span>
<span style="color:rgb(0,102,187);font-weight:bold">on:</span> <span style="color:rgb(170,102,0)">#propertyValue</span> <span style="color:rgb(0,102,187);font-weight:bold">of:</span> <span style="color:rgb(187,0,102);font-weight:bold">ValueHolder</span> <span style="color:rgb(0,112,32)">new</span>;
<span style="color:rgb(0,102,187);font-weight:bold">label:</span> <span style="background-color:rgb(255,240,240)">'About yourself.'</span>;
<span style="color:rgb(0,102,187);font-weight:bold">beRequired</span>.
<span style="color:rgb(153,102,51)">mold</span> <span style="color:rgb(0,102,187);font-weight:bold">checkboxField</span>
<span style="color:rgb(0,102,187);font-weight:bold">on:</span> <span style="color:rgb(170,102,0)">#propertyValue</span> <span style="color:rgb(0,102,187);font-weight:bold">of:</span> (<span style="color:rgb(187,0,102);font-weight:bold">ValueHolder</span> <span style="color:rgb(0,102,187);font-weight:bold">with:</span> <span style="color:rgb(0,112,32)">true</span>);
<span style="color:rgb(0,102,187);font-weight:bold">label:</span> <span style="background-color:rgb(255,240,240)">'Sign for the newsletter'</span>;
<span style="color:rgb(0,102,187);font-weight:bold">addCondition:</span> [ <span style="color:rgb(51,51,51)">:</span><span style="color:rgb(153,102,51)">input</span> <span style="color:rgb(51,51,51)">|</span> <span style="color:rgb(153,102,51)">fullname</span> <span style="color:rgb(0,102,187);font-weight:bold">isValid</span> <span style="color:rgb(0,102,187);font-weight:bold">not</span> <span style="color:rgb(0,102,187);font-weight:bold">or:</span> [ <span style="color:rgb(153,102,51)">input</span> <span style="color:rgb(0,102,187);font-weight:bold">or:</span> [ <span style="color:rgb(153,102,51)">fullname</span> <span style="color:rgb(0,102,187);font-weight:bold">value</span> <span style="color:rgb(0,102,187);font-weight:bold">first</span> <span style="color:rgb(0,102,187);font-weight:bold">=</span> <span style="color:rgb(0,68,221)">$K</span> ] ] ]
<span style="color:rgb(0,102,187);font-weight:bold">labeled:</span> <span style="background-color:rgb(255,240,240)">'Sorry, you may not opt out of our spam unless your name starts with K.'</span>.
<span style="color:rgb(153,102,51)">mold</span> <span style="color:rgb(0,102,187);font-weight:bold">openDialog:</span> <span style="background-color:rgb(255,240,240)">'Example Eight'</span>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p><font size="4"><br>
</font></p>
<p><font size="4">Hilaire</font></p>
<pre cols="72">--
<a href="http://mamot.fr/@drgeo" target="_blank">http://mamot.fr/@drgeo</a></pre>
</div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><font face="arial, helvetica, sans-serif">R. Mark Volkmann</font></div><div><span style="font-size:12.8px"><font face="arial, helvetica, sans-serif">Object Computing, Inc.</font></span></div></div></div></div></div></div></div></div>