[yunqa.de] Re: MaskEdit DIRegEx

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Mon, 21 Dec 2009 14:15:36 +0100

At 23:11 20.12.2009, Ephraim Rubenstein wrote:

>I am evaluating the DIREgEX suite. Impressive but the Mask Control demo is not 
> clear.
>Specifically depending on ValidationNeeed I cannot change the text in the 
>MaskEdit.
> 
>It is not clear to me when the MaskEdit is editable (based on 
>ValidationNeeded) and when it is not editable.
>
>The only clear understanding  I have is evNoValidation allows me to enter text 
>into the MakEdit and when tie pattern is matched it validates. I can then 
>delete the text if I wish.

* evNoValidation:

Correct. With evNoValidation, there is no pattern validation. Editing is always 
possible. Like with TEdit, users can enter text unrestricted.

In evNoValidateion mode, validation is left to the application if required. 
However, backgroud coloring (like in the DIRegEx Mask Controls demo) can give 
visual feedback if the input is acceptable or not.

>How do evPartialValidation and evFullValidation work with editing?

* evPartialValidation:

Input is validates and is accepted for full and partial pattern matches.

Consider this example, which matches abbreviated weekdays or an empty string:

  MatchOptions: moPartialSoft
  Pattern: ^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|)$

For input like 'j', 'ja', 'f', or 'fe', the pattern does not match completely. 
However, the first characters already match and the pattern is said to match 
partially. Partially matched patterns validates against edPartialValidation, so 
input is allowed. They do not validate against evFullValidation (input 
rejected). evFullValidation would require 'jan' or 'feb', for example.

Partial validation usually helps to simplify patterns which require a 
particular sequence of characters (like above) instead of just types of 
characters (like ^\d+$ for digits).

Note that at least moPartialSoft or moPartialHard must be set to allow partial 
matching in the first place!

* evFullValidation:

With evFullValidation, input validates only if the complete pattern matches. 
Partial matches are therefore rejected in evFullValidation mode.

In the above example, full validation would not allow to type the letters 'j', 
'a', 'n', because the first two would be rejected. In other words: 
evFullValidation would not allow to type 'jan', even though 'jan' itself is 
perfectly valid. However, pasting 'jan' is possible because it skips the 
intermediate "typing" steps 'j' and 'ja' which do not match the entire pattern.

It is often possible to rewrite evPartialValidation patterns to use 
evFullValidation instead. Nevertheless, the resulting patterns are usually far 
more complicated and will therefore attract bugs more easily.

Ralf  

_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: