Author Topic: Mask problem with EZ_Text  (Read 2738 times)

Brian Reynolds

  • Newbie
  • *
  • Posts: 22
    • View Profile
Mask problem with EZ_Text
« 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.

« Last Edit: January 17, 2022, 12:56:52 am by Brian Reynolds »

Chris Boss

  • Administrator
  • Jr. Member
  • *****
  • Posts: 60
    • View Profile
Re: Mask problem with EZ_Text
« Reply #1 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.

Brian Reynolds

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Mask problem with EZ_Text
« Reply #2 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}"

Chris Boss

  • Administrator
  • Jr. Member
  • *****
  • Posts: 60
    • View Profile
Re: Mask problem with EZ_Text
« Reply #3 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.

Chris Boss

  • Administrator
  • Jr. Member
  • *****
  • Posts: 60
    • View Profile
Re: Mask problem with EZ_Text
« Reply #4 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.

« Last Edit: January 18, 2022, 11:06:46 am by Chris Boss »