overwrite digits in a textfield

2015r1 / El Capitan:

TextField and TextArea: mask ####, default text 2017

If you select the whole contents (2017), you can delete it, but if you type a number you will get a Beep.

2017r2.1 / El Capitan:
Far different behavior: typing a digit (0-9) clears the selection and replace it with the typed digit.

Some people have to read the release notes to know when the changes were made.

Nota: I run Xojo 2017r2.1 (the “current” version) only for testing purposes (to check if I found a Xojo 2015r1 bug or if it is mine) only.

More details:
I was wrong above: both works the same. The difference appears when the mask is different, for example ####-##-## (for SQLDate):
2017-11-05

If you select the two digits for the month (11 here), a type a number THEN you get a beep…

My bad, sorry.

One last word: if you select the last two digits (to change the day number from 05 to 04 for example), and type a number… it works !

INCREDIBLE.

I’d better not enter in that discussion :frowning:

Thank you Tim. I think I know why you say that’s a bug on Mac.

When you assign something to me.Text (in this example), you don’t know if it will be longer or shorter, so it’s better to reset the me.SelStart position to 0, like Windows. But for newbies like me what happen on Mac is what, at least in my case, I expected.

I just did a test with me.Text = “1” , with “12” and “123”

On Windows anything will reset me.SelStart to 0
On Mac, if the new text is shorter (can’t have the me.SelStart value), then me.SelStart = highest available position, so:

  • me.SelStart = 3 and me.Text = “1”, then after that me.SelStart = 1
  • me.SelStart = 3 and me.Text = “12”, then after that me.SelStart = 2
  • me.SelStart = 3 and me.Text = “123”, then after that me.SelStart = 3

I was curious to what happened after me.SelStart = me.SelStart + 1. Both Windows and Mac if the last possible position is the value that me.SelStart has, then the value will not change (as expected).

Anyway, I think this is something Xojo could make the same on Windows and on Mac, either reset the SelStart to 0 after a text assignment like on Windows or use what is happening on Mac.

[quote=357635:@Emile Schwarz]One last word: if you select the last two digits (to change the day number from 05 to 04 for example), and type a number… it works !

INCREDIBLE.

I’d better not enter in that discussion :([/quote]

And if you select everything, you can also write over it.

As a newbie I expect that if I select some numbers then I’m in overwrite mode. I should be able to select the year/month and change it and not only the day, as you found out.

Maybe a feature request? or maybe a bug with mask?

BTW: did you (Alberto or the Reader) checked that under Windows ?

Sometimes a feature can be implemented using Linux / macOS / WIndows (one of them) behavior for all platforms (because the developer forgot to check if they are the same on all platforms: this can happens).

Emile, I did a test under Windows and the same results, if you select all or the last 2, you can overwrite the numbers, if you select the year or the month, you can’t overwrite them.

But, if you change the mask from ####-##-## to 9999-99-99, then all overwrite works (you can select the year, month, day or everything).

I have read several times the Mask documentation and I still do not understand the difference between # and 9.

That is exactly the question I was asking me !

Maybe this is the real mask to use in some cases like Date, Phone #, whatever ?
Because of the Xojo origin, we may have # for “compatibility” reasons ?

I personally abandoned Mask altogether because of its numerous deficiencies. I created my own Textfield subclass and never looked back.

Xojo can be considered as an application skeleton creator. One have to use Declare / PlugIns if (s)he want to put good contents to its applications.

Very strange.

Even this software (this forum software) behave strangely: put some text, place the cursor at the top of that text because, after all, you want to add some text from a previous entry, click in the “ button and the text extract will be copied at the end of the current reply … :frowning:

Thank you so much
Alberto De Poo

Also, thank you very much everyone for your great help that helped me solve
the situation raising

regards

Raul Juarez Pulachee