[Gambas-user] Maskbox mask & text entry

Tobias Boege taboege at ...626...
Thu Mar 19 19:20:22 CET 2015


On Thu, 19 Mar 2015, John Rose wrote:
> On 18/03/15 11:30, John Rose wrote:
> > I have a Maskbox with mask [A-Za-z][A-Za-z]. I noticed that the IDE
> > does not show the MaxLength property. I want the user to be able to
> > enter lower case & have the entry displayed as upper case for either
> > of the 2 characters. When I run the attached Test app, it only seems
> > to allow the entry of 1 characted. When 'a' followed by 'd' is
> > entered, the Maskbox displays D and the Console shows from the Print
> > statements carried out by code conversion of lower case to uppercase:
> > SteckerMaskBox.MaxLength=0
> > SteckerMaskBox.Length=1
> > SteckerMaskBox.Text=a
> > SteckerMaskBox.Mask=[A-Za-z][A-Za-z]
> > Length=1
> > SteckerMaskBox.MaxLength=0
> > SteckerMaskBox.Length=1
> > SteckerMaskBox.Text=d
> > SteckerMaskBox.Mask=[A-Za-z][A-Za-z]
> > Length=1
> >
> > What is the solution to allow a 2 character entry?
> >
> > PS I'm using Gambas Stable Builds ppa with gambas version showing as
> > 3.7.90 though Gambas IDE Title bar shows DEVELOPMENT VERSION - USE AT
> > YOUR OWN RISK. Could this 'Stable' ppa contain a jinxed Gambas version?
> >
> Gambas Stable Builds ppa has now updated Gambas version to 3.7 and
> Gambas IDE Title bar no long shows DEVELOPMENT VERSION. However, this
> Maskbox issue still present. I shall assume it's a bug and post it on
> Gambas Issues unless I'm told different before tomorrow.

What I write below is observations from experiments I made. I don't usually
use MaskBoxes so I don't know if the behaviour has always been like that or
if it is intended.

Apparently, inputting into MaskBoxes works a little different than into
TextBoxes. Imagine the MaskBox as an array of cells where the things you
can put into each cell is defined by the mask.

If you press a key and that is valid input for your current cell, the
corresponding character is put into that cell, *without* advancing the
current cell. You need to use the arrow keys to do that. Using your program
this way shows no problem.

You may want to make your own little MaskBox lookalike using the "CheckInput
idiom"[0] if this is not the way you like.

Regards,
Tobi

[0] http://www.gambas-buch.de/dw/doku.php?id=k16:k16.6:k16.6.3:start

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list