[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Aw: Re: Important change in MaskBox control



> Am 15.04.26 um 18:33 schrieb Benoît Minisini:
>> Le 14/04/2026 à 22:38, Claus Dietrich a écrit :
>>> Hi Florian
>>>
>>> Am 14.04.26 um 17:35 schrieb Florian Brunke:
>>>>
>>>>     Users that came previously from MS Office applications, for
>>>>     instance, are used to maskboxes where every single position in the
>>>>     predefined mask is just overwritten by typing characters or
>>>>     digits. This happens in "forward" direction. Using backspace,
>>>>     characters are deleted and replaced by the placeholders and the
>>>>     cursor is moved left.
>>>>
>>>>     Either way the separators are just ignored as if they weren't
>>>>     there. That is the fastest way to insert data in specified
>>>>     maskboxes that I can think of, as it is not necessary to click or
>>>>     use arrow keys.
>>> To refresh my memory and for comparison I just tried the Microsoft
>>> MaskEdBox of Visual Basic 6 (where I came from long time ago). As
>>> expected and as you say - it is behaving as if the separator wasn't
>>> there, which is also true when using the backspace key. I fully agree
>>> with you that this is the fastes way to operate such a control. But
>>> this is not what the Gambas MaskBox is doing when using the backspace
>>> key. It makes a stop-over just left from the separator. So I have to
>>> press the backspace twice to delete the next left digit when it
>>> passes the separator. This is the reason I modified the MaskBox and
>>> propose to adopt my change.
>>>
>>> I hope that this helps to get a common view on this issue and a
>>> common position.
>>>
>>> Best regards, Claus
>>>
>>
>> Is it better with the last commit? Now 'Backspace' always ignore
>> separators, whether they are weak or strong.
>
>
> Hi Benoît,
>
> now backspace works fine!! Great! And I think, this is what we wanted...
>
> 1) Still there is the issue with overwriting "0" placeholders.
>
> As a reference I would like to show you the inputmasks used by MS
> Access. Parts of it I find quite useful.
>
> https://learn.microsoft.com/en-us/office/vba/api/Access.TextBox.InputMask
>
> In Access the cursor will generally appear in "overwrite-mode", so that
> the according positions are ALWAYS overwritten. In my opinion this is
> especially useful with masks using "0"s. (e.g. "00:00" or "00.00.0000" -
> which I use the most). You can even do funny things like the following
> in  inputmask definitions: 99.99."20"00 (which fixes the first to digits
> of the year)
>
> Apart from that those inputmasks are rather "stiff"...
>
> They would not be useful with the weak separators that you implemented
> lately, Benoît. Those need an "insert-mode" as, for instance, with the
> currency example ($##<[,]###<[,]##0<!.00) and the thousands-
> (weak)separators
>
> I guess, we need both modes, insert and overwrite, for different purposes.
>
> 2) I seems to me that the "0" is treated as placeholder and is therefore
> overwritten just anytime when it is in the text.property of the maskbox.
> It doesn't matter if it originates from the mask definition or if you
> typed it in manually. I think the behaviour of a mask position should
> only be dependent of the according position in the mask definition and
> be independent of the inserted content. - Is it understandable what I mean?
>
>
> Best regards,
>
> Florian
>


I don't understand what you are talking about the insert / overwrite
stuff. Maybe I need more examples.

At the moment, if a part of the mask (something between two strong
separators) is right-aligned, insertion mode is used. If it is
left-aligned (the default), overwrite mode is used. I find that rather
logical.

For your year 2000 example, does not « 99.99.[2][0]00 » make the job?

Regards,

--
Benoît Minisini.
 
Hi,
okay I will clarify this by something you can all test:
1- Use the following mask definition in a MaskBox: "!00:00"
2- now enter "12:34" into the MaskBox; you will see, every position will be OVERWRITTEN
3- next, put the cursor to the most left
position again and try typing in new digits; you will see nothing happens, because the positions are not overwritten again.
4- now delete the whole MaskBox and insert: "11:05" 
5- put the cursor just right of the ":" separator
6- type "12"; you see that the
you can insert the "1" by OVERWRITING but not the "2" (confronted by anything but "0", overwriting is blocked)
7- the same happens, resp. again nothing happens, if you put the cursor in the most left position
8- finally something special to demonstrate: 
delete the MaskBox contents again and insert "10:20"
9- now you will see that you can insert and OVERWRITE the segments before and after the ":" separator. So, apparently, if the right position of the segment is a "0", overwriting works. 
In this kind of mask I think digits should generally be overwritten in any position.
Best regards,
Florian

Follow-Ups:
Re: Aw: Re: Important change in MaskBox controlBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Important change in MaskBox controlClaus Dietrich <claus.dietrich@xxxxxxxxxx>
References:
Important change in MaskBox controlBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Important change in MaskBox controlClaus Dietrich <claus.dietrich@xxxxxxxxxx>
Re: Important change in MaskBox controlBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Important change in MaskBox controlClaus Dietrich <claus.dietrich@xxxxxxxxxx>
Re: Important change in MaskBox controlBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Aw: Re: Important change in MaskBox controlFlorian Brunke <taitetao@xxxxxx>
Re: Important change in MaskBox controlClaus Dietrich <claus.dietrich@xxxxxxxxxx>
Re: Important change in MaskBox controlBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>