TMaskEdit: several bugfixes
Original Reporter info from Mantis: Bart @flyingsheep
-
Reporter name: Bart Broersma
Original Reporter info from Mantis: Bart @flyingsheep
- Reporter name: Bart Broersma
Description:
This patch (diff against revision 18002 of maskedit.pp) fixes the following issues:
- It was not possible to enter lowercase characters
- SetText should not raise an exception (Delphi compatibility)
- Multi-field EditMaks were not handled correctly
- Clear should fill the controll with blanks (Delpi compatibility)
- cMask_Number, cMask_NuberFixed, cMask_Letter and cMaskLetterFixed had wrong
values (they were reversed)
- Mask characters C, c and # are now supported
- UpperCase after Lowercase was not handled correctly, the same for LowerCase
after uppercase and the occurence of <> in the mask
- A ! in a mask should not be considered a literal, unless escaped
It has special meaning (remove trailing or leading blanks from the data)
- ClearChar should only return mask-literals or FSpaceChar (Delphi
compatibility)
- Text and EditText property were the same (when read), now BlankChar is
replaced by #32 if you read TMaskEdit.Text,
Also trimming is applied if mask is not saved as part of the data
(as set in the second field of EditMask)
- You could paste more characters in the MaskEdit control than the
EditMask allows for. When you did this you cannot delete these
characters using only the keyboard, since you cannot reach them with
the arrow keys or VK_END (see notes in maskedit.pp)
- No exception was raised if the text in the control does not match the
mask on exiting the control. (I introduced a conditional define to
skipp validating in DoExit, but feel free to remove this)
- In setting TMaskEdit.Text, non-matching characters should be ignored
(blanked out)(Delphi compatibility up to at least D7)
- Implemented Reset()
- Implemented ValidateEdit
- If you type in the control and the conrol is "full" the cursor now
is behind the last character, not in front of it
(the same for pressing VK_END)
- Whilst typing in the MaskEdit control, it will now nicely
skipp any litteral in the mask, proceeding to the next character after
the literal and selecting this (this also works for Backspace) (not really a
bug, but a nice feature, as in Delphi)
Some problems remain.
ToDo List:
- Make the EDBEditError errormessage (SMaskEditNoMatch) a Resource string in LCLStrconsts.pas (I don't know how to do this, and it needs approval of core team I guess)
- Better handling of cut/clear/paste messages
Bugs:
- UTF8 support for maskcharacters C and c, probably needs major rewrite!!
Additional information:
I ended up doing a major rewrite of the internal logic of translating cursorposition to position in the editmask. I also completely rewrote all cursor placement routines.
This patch is tested on win32, Linux/GTK1 and Linux/GTK2
For GTK1 to function, the patch for issue #11800 (closed) is necessary
I diff'ed against revision 18002 of maskedit.pp, this resulted in a patch being larger then the original file, so I upload the maskedit.pp also.
Mantis conversion info:
- Mantis ID: 12920
- OS: WinMe
- OS Build: MS
- Platform: i386
- Version: 0.9.27 (SVN)
- Fixed in version: 0.9.27 (SVN)
- Fixed in revision: 18192 (#f6bd9d36)
- Target version: 0.9.28