Phil,

Ok, here is what I got so far and it works.

APP
// This is apart of the Configuration to set the Phone to USA or International (Mask or no mask)
Dim Con1 as Boolean = True // Mask Used

MAIN
[PhoneNo1]
(GotFocus)
 if app.con1 and me.text="" or me.text="(" then
   me.text="("
   me.SelStart = len(me.Text)
   me.SetFocus
 end

I had to make sure the entry field was empty [me.text="" ] AND if con1 is true then put a "(" then setfocus after the "(". The enduser could start to enter the data after that without thinking anything of it within the MASK of (###) ###-####. Now the [or me.text="(" ] was added as if you changed the Config for the Phone from International to USA it added in all the phone enties a "(" so I had to check for that as well.

I am not very happy about this as the Mask Field should work without any issues as it did in Rapid-Q. RS needs to find out why this does it as it does it in RealBasic 5.5.5 Pro Win as well.

Thanks Phil for all you help,

Jonathon





----- Original Message ----- From: "Phil M" <[EMAIL PROTECTED]>
To: "Getting Started" <[email protected]>
Sent: Friday, February 17, 2006 4:13 PM
Subject: Re: Editfield Masks


On Feb 17, 2006, at 2:44 PM, Jonathon Bevar wrote:

I have a setup in the Config of my app to have USA or International config. The USA of course uses the mask and the International uses NO masks at all.

But I am still wondering WHY the mask interferes with the enduser inputing data to it?

I don't have an answer for that.

"Also, if the text evaluates as valid but in a different format you can use the LostFocus () event to enforce the telephone format you expect: 493.555.1039 => (493) 555-1039."

Ok, are you saying that after the enduser inputs the data and then tabs to the next entry the data then becomes 'formated' or masked in the previous entry or will BEEP if it is not correct?

Yes.

So how would i set something like that up in my code?

One example is where most Adobe products allow you to input numeric values. Using their numeric input field, you could input values such as "3.0123456789" and when you tab/LostFocus() or Enter/Return, then the value is rounded to a certain value... in this case "3.012". In addition, the numeric field allows you to enter values in different measurement systems... if your preferences are set to inches, you could enter a numeric value in points, centimeters or some other measurement system if you know the code. For a more detailed description of this, take a look at my StepField documentation:

    http://developer.dreystone.com/stepfield.php

If a value inputted is invalid, such as "3.ab0", then a message dialog appears in the Adobe products and forces the focus back to the control which has the error. Adobe products are usually nice enough to describe the range of acceptable values such as "please enter a value between -600.0 and 600.0" whereas "3.ab0" is non-numeric and invalid.

So back to the phone number issue... the simple solution would be to call from the LostFocus() event a function to validate the phone number and return false if it is not valid. Your code would look something like this:

  Sub LostFocus()
    If Not ValidPhone(Me.Text) Then
      MsgBox "Please enter a correctly formated telephone number."
      Me.SetFocus
    End If
  End Sub

Very simple, but the problem with the above code is that the very act of creating a MsgBox causes the LostFocus event to fire and for some reason it triggers the LostFocus() event twice (some sort of collision of events). Instead, what REALbasic does is put these messages in the status bar at the bottom of the screen. To function properly, the only method I have been able to use is to trigger a thread which calls the MsgBox after a short period of time like 10 ms.

You could just as easily use a Beep and SetFocus (this will work fine) but it may not be immediately obvious to the end-user. For phpRegistration, I think that I had a static text message notifying the user when they clicked the "Submit" button... this is OK too.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>




--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.10/263 - Release Date: 2/16/2006




--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.10/263 - Release Date: 2/16/2006

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to