El 01/11/2021 a las 15:31, Bart via lazarus escribió:
The target in *Windows classes is to mimic the old fashion CMD masks,
and CMD masks does not have ranges or sets.
OK, this is by design.
Since that is however not backwards compatible (the old mask
implementation supported sets out of the box by default on all
platforms, I changed "our" implementation.
A note: IIRC (do not have the source at hand here) you escape [ ] and
\, with or withoud mocEscapeChar enabled.
if mocEscapeChar is not enabled, escaping these in the mask is
probably not what you want.
Hello,
The MaskWindows is to mimic Windows behaviour, it's an implementation
using the complete TMask as engine, so this class controls everything
and the user (programmer) only provides a mask, can not select, or
should not be able to select, which features are available in the
engine. If my class works in a different way its my mistake.
In the other hand I recall why the escape is necessary instead disabling
features, to mimic the "file?.dat" which must be transformed to my TMask
"file[?].dat", if I left the "AnyCharOrNone" enable and disable sets and
ranges this mask will not be interpreted correctly "fil[?.dat" so
escaping in that function is a must.
LCL's TMask raises syntax errors (or others, I can not recall) at
creation time and in my code the syntax check is at Compile time so I
call compile to raise an exception if needed.
[...]
So, I changed it (and documented it as a change that breaks backwards
compatibility).
That's a design decision, I choose the other one based in the reason
exposed.
Compile should not be called again unless the mask is changed
via the property.
I think, that does not happen.
The Mask property IIRC does not have a setter.
You are right, I forget that when pusblished the Mask property.
I introduced a setter for the mask property, it sets fMaskIsCompiled to False
Also, if compile fails and the user/prgrammer is stupid enough to call
Matches again, Matches will simply return False (no exception), whic
(even if the programmer is stupid) is a bad thing IMO.
I fixed that by setting fMaskIsCompiled to False as first line in
Compile and only set it to True if Compile does not raise an exception
(so it finishes).
Good solution, yes.
Something else.
When you reset the mask, you should also reset the internal
representation of the mask and it's associated length value, otherwise
you get an access violation when you set mask via the property and
then call Matches.
Quite sure, yes, everything must be reseted.
--
--
_______________________________________________
lazarus mailing list
[email protected]
https://lists.lazarus-ide.org/listinfo/lazarus