Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-09

MaskEdit question

9 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart

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.

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

Reply by email

Bart
to Gerard N/A

Hi Gerard,

Thanks for testing.

Show quoted text 5 lines
If I set EditMask to 'ccc_ccc;1;+' , with D7 and D2010: MaskEdit.Text ' ? _ ? ' (3 spaces, '_', 3 spaces) MaskEdit.EditText '+++_+++'

So the '_' is treated as a lireal '_', not as a literal space.

The Delphi (3) help states:
The _ character automatically inserts spaces into the text. When the user enters characters in the field, the cursor skips the _ character.

Note that this text is rather ambivalent. It saya it inserts a space, but then says it skips the '_' ?

Does the D7 / D2010 help say anything about using '_' in a mask?

If the help text is still the same, I think we shouls implement it as the help text says it should work (treat '_' as '\ '), and consider the current Delphi behaviour as a bug.

Bart

Reply by email

Gerard N/A
to Bart

Hi Bart,

So the '_' is treated as a lireal '_', not as a literal space.

So it seems.

The Delphi (3) help states: The _ character automatically inserts spaces into the text. When the user enters characters in the field, the cursor skips the _ character.

Same explanation in D7 Help. I don't have D2010, I asked a friend to test for me.

If the help text is still the same, I think we shouls implement it as the help text says it should work (treat '_' as '\ '), and consider the current Delphi behaviour as a bug.

I don't know what is the usual way to do with Delphi bugs like this one. Fix them or keep compatibility even with the incorrect behaviour?

Regards,

Gerard.

Reply by email

Bart
to Gerard N/A

Hi Gerard,

Same explanation in D7 Help. I don't have D2010, ?I asked a friend to test for me.

Could you ask him to look at the help text also?

I don't know what is the usual way to do with Delphi bugs like this one. Fix them or keep compatibility even with the incorrect behaviour?

That we can discuss here.
I'ld say: fix it to behave as the help says it should.

Bart

Reply by email

Gerard N/A
to Bart

Hi Bart,

Could you ask him to look at the help text also?

Sorry, he's got a Trial version and the help doesn't to be installed. He'll try to download the help.

Show quoted text 7 lines
> I don't know what is the usual way to do with Delphi bugs like this > one. Fix them or keep compatibility even with the incorrect behaviour? That we can discuss here. I'ld say: fix it to behave as the help says it should.

Seems reasonable to me.

Regards,

Gerard.

Reply by email

Bart
to Bart

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

Reply by email