[Lazarus] unit Masks vs. unit FPMasks

Bart bartjunk64 at gmail.com
Tue Feb 23 23:06:38 CET 2021


On Tue, Feb 23, 2021 at 6:55 PM Juha Manninen via lazarus
<lazarus at lists.lazarus-ide.org> wrote:

> How about TMask? Does it have the same syntax as TMaskEdit or are they different?

TMask (unit masks) deals with masks with wildcards (*,? and sets of
single byte chars).
It is mainly used for matching filenames (similar to the Path supplied
to FindFirst).

TMaskEdit gives you the possibility to constrain user input to almost
anything you like,
Can be used for e.g. ZIP codes, only numbers etc.
It also handles pasting in the control.
If the text the user enters does not match the specified mask when the
control looses focus (or user presses enter) an exception is raised.
In the Delphi 1,2,3 years I used it to force numeric input (integers
and floats), for which we nowadays have better controls.
There is a data aware counterpart as well.

As you have pointed out before, the GetCodePoint function in the Masks
unit needs overhoaling.
(It is the same as in TMaskEdit, but that only reacts to user input
with strings <=255 chars, so speed is not required there: I'ld love to
see someone typing faster that the code in TMaskEdit calculates what
needs to be done.)

-- 
Bart


More information about the lazarus mailing list