MaskEdit question lazarus / 8-Other ---------------------------------------------------------------------- Bart · 2009-09-26 22:43 Hi, I try to maintain MaskEdit.pp for Lazarus. I have a Delphi compatibility question that I cannot check for myself, since I only have an ancient Delphi 3. If one specifies a '_' in the mask (that is not in the part where it sets the "blank" char used by the control) what does it do? - does it set a literal (= cannot be altered or deleted) '_' in the Text - does it set a literal space (#32) in the Text My Delphi 3 does the first. The Delphi help states: The _ character automatically inserts spaces into the text. When the user enters characters in the field, the cursor skips the _ character. Clearly it does not in D3 This might actually be a D3 bug? In maskedit.pp there is a cMask_SpaceOnly defined and the comments suggest it puts a space (#32) in the mask. Obviously D3 does not, but newer versions might? To give an example for a MaskEdit: Set EditMask to 'ccc_ccc;1;+' and clear the control (this should be done automatically when setting the mask) is the value of MaskEdit.Text '   _   ' (3 spaces, '_', 3 spaces) and MaskEdit.EditText '+++_+++' or is the value of MaskEdit.Text '       ' (7 spaces) and MaskEdit.EditText '+++ +++' (3 '+', space, 3 '+') Or to put it in other words: does EditMask 'ccc_ccc' behave as 'ccc\_ccc' or as 'ccc\ ccc' ? Currently Lazarus puts a "blank" in EditText and a space in Text, which probably is wrong. Can anyone testwith a recent version of delphi, so I can fix it if necessary? Bart ---------------------------------------------------------------------- DougNettleton · 2009-09-29 15:33 Hi Bart: Delphi 6 with the mask ">l9l 9l9;0;_",  "a1b2c3" displays as "A1B 2C3", the Canadian postal code format and of course stores "A1B2C3". with mask ">l9l_9l9;0;_", "a1b2c3" displays as "A1B_2C3" and the value of "Text" is "A1B2C3" with mask ">l9l_9l9;1;_", "a1b2c3" displays as "A1B_2C3" and the value of "Text" is "A1B_2C3" So, I guess EditMask 'ccc_ccc' behaves as 'ccc\_ccc'. HTH, Doug ---------------------------------------------------------------------- Bart · 2009-09-30 15:08 As someone told me even in D2010 it behaves like '\_' Real question now is: do we fix the apparrant Delphi bug in Lazarus and make it behave as the help text says, or do we implement it as Delphi does (the wrong way), in order to remain compatability? So, opninions on that are welcome. ---------------------------------------------------------------------- DougNettleton · 2009-09-30 21:39 What possible reason do you have to make it work like '\ '?  Given that ' ' already works like that since the backslash is only used to force an otherwise mask character as a literal.  Why effectively make "_" into a "mask character", when in spite of the documentation - at least with Delphi 6 - this mask character is not needed at all?  Anyways, since I can't imagine ever wanting a literal "_" in field and " " already does what you're considering changing "_" to do, whichever choice you make won't affect me at all - unless you break the way " " currently functions. Regards, Doug ---------------------------------------------------------------------- Bart · 2009-10-04 21:22 If no one objects, I will implement it like it behaves in Delphi, that is a '_' in a mask (unless specified in the last field) is treated as a literal '_' If Embarcadero/Delphi decide to change the behaviour to what the help text says, we'll change it too. Bart