Computer Workshop forums

EZGUI 5.0 Professional => EZGUI 5 support forum => Topic started by: Brian Reynolds on January 17, 2022, 12:51:12 am

Title: Mask problem with EZ_Text
Post by: Brian Reynolds on January 17, 2022, 12:51:12 am
I am having difficulty handling a Mask with the EZ_Text control.

I have tested the following:

EZ_Text %FORM1_BIRTH, 22, 11, 14, 1.75, "", "EST{##-##-####}"
appears okay when the date "25-05-1904" is loaded from a file but doesn't allow keyboard input.

The EZ_Text line is Subclassed.

Title: Re: Mask problem with EZ_Text
Post by: Chris Boss on January 17, 2022, 03:56:42 pm
Change the Mask to:

{99-99-9999}

The # character may confuse the Masked Edit control since that normally is used for calculator mode masks.
Title: Re: Mask problem with EZ_Text
Post by: Brian Reynolds on January 18, 2022, 12:36:02 am
The folling line produces exactly the same result as my earlier example.
Data looks good when loaded from a file, or off a ListView, but I can't input new daya from the keyboard

   EZ_Text %FORM1_BIRTH, 22, 12.25, 11.75, 1.75, "", "EFT{99-99-9999}"
Title: Re: Mask problem with EZ_Text
Post by: Chris Boss on January 18, 2022, 11:01:36 am
Make sure that the data loaded into control always matches the mask (in position and length).

A Masked Edit control should never have the initial value set to a null string ("") !

The control should always have the exact number of characters in it as the mask does at all times, otherwise it messes up the control.

So rather than:

Code: [Select]
   EZ_Text %FORM1_BIRTH, 22, 12.25, 11.75, 1.75, "", "EFT{99-99-9999}"

You should have something like:

Code: [Select]
   EZ_Text %FORM1_BIRTH, 22, 12.25, 11.75, 1.75, "01-01-2000", "EFT{99-99-9999}"

There has to be a default value in the control.
Title: Re: Mask problem with EZ_Text
Post by: Chris Boss on January 18, 2022, 11:04:51 am
If you want to define the current date as the default then  set the option (in designer) to generate the %EZ_Loading event. Then in the %EZ_Loading event you can swap in a string for the current date by using the EZ_SetLoadStr command.

This way the control when first created would have the current date and then the user can change that to a different date manually.