My PhoneMaskHandler class

Thanks to the folks on Skype chat last night who helped resolve my un-brain moment I was able to resolve my “find the next control” issue and complete this handy little class.

If you have a prompt with the text phone, fax or mobile in it then this class will change the picture on the next entry control to the hard coded ‘@K## #### ####KB’ or in the case of mobile ‘@K#### ### ###KB’.

The class and others that it depends on are in the ClarionClasses repo.

The magic line to get the next control in sequence…

duh! Lol! :rofl:

Just to add complication to the class and remove it from me , any thoughts on handling international differences?

1 Like

Well… short answer is don’t hard code them :innocent:

It kinda depends on how you are handling internationalisation in general. Probably the most generic way would be to make the masks properties of the class so you would use it like:

ThisWindow.Init                 PROCEDURE()
PhoneMask                       PhoneMaskHandler
  ! blah, blah


  PhoneMask.MobileMask = '@K#### ### ###KB'
  PhoneMask.PhoneFaxMask = '@K## #### ####KB'  ! (or PhoneMask.LandlineMask ?)
  PhoneMask.Init(SELF, TRUE)

And then the class uses those property values instead of hard coded ones.
Or pass them in as parameters of Init?

Ohh, or do you mean handling different formats all at once?!!
Yeah nah. In my use case that’s a non issue for now so I had not tried.

Maybe the only way to do that would be on EVENT:Accepted with a regex of some form.

Likely a data problem dependent upon the country code. I looked at your mask examples and immediately thought, that does not work here in the US. More & more, I see long mobile numbers without any mention of country.

Do any of those numbers have a + on the front? At least then you’d know (in theory) that it’s an international number.
Either that or put a field on the front for international country code

Clarion does have Regex that would work here. The Pipe is the OR Operator:

IF STRPOS(thisField{PROP:Text},'phone|mobile|fax',1) ...
IF MATCH(thisField{PROP:Text},'phone|mobile|fax',Match:Regex+Match:NoCase)

This code is untested. I often get it wrong, I have to remember the parameters are opposite of INSTRING(Find_This, In_this)

PROP:Precedes is alternative that would probably work better in all cases, like if your Prompt did not have a USE() it would have FEQ > 32000 buyt ENTRY would be in order 1,2,3,4. Prop: was added in C10. I.e. this Prompt FEQ “Precedes” (is before) what FEQ:

nextField = thisField{PROP:Precedes) !was--> nextField = (thisField+1)

1 Like

Ohhh, interest. Thanks!

I see it’s not in the help and a search here doesn’t get any hits from the release notes.

Looking at EQUATES.CLW:

PROP:Precedes         EQUATE(7A7EH)  ! Inverse of PROP:Follows read-only, runtime only

@Rick_UpperPark - I see also that PROP:Follows is marked read/write now too:

PROP:Follows        EQUATE(7C99H)  ! integer, read/write, runtime only

The docs could do with an update :smiley:

The docs could do with an update :unamused: :worried: :poop:

There is time between code releases for the Help to catch up. Seems fair to say it has almost been abandoned. I had talked to Z about moving the Help online and he liked the idea but it has not happened. Delphi help is online.

For now you have to read the Blog, look at release ReadMe.Txt, review listed PTTS, and compare LibSrc + Template folders… It’s exciting to find new things but should be easier. The problem is likely there is no documentation author that is looking for something to write everyday…

Where have you gone, Robert “Bob” Foreman?
Developers turn their lonely eyes to you
Woo, woo, woo
What’s that you say, Mr. Robert Z ?
Verbose Bob has left and gone away
Hey, hey, hey
Hey, hey, hey

Koo-koo-ka-choo, Richard Taylor
Geeze we miss you more than you will know
Whoa, whoa, whoa
See Also, See Also, See Also


So many names, so many verses in the land of Clarion and LexisNexis.

At least they future-doc’d the USTRING and 64 bit integers so that’s the first thing you see before you can’t find what you’re looking for…

You have a problem with & Alt keys so ‘Fa&x’ does not contain ‘fax’ e.g.

PROMPT('Fa&x Number:'),AT(10,44)

Which is easily solved by changing PROP:Text to PROP:Value which does NOT have the &. Also works for other controls with &Alt keys like TAB, OPTION, RADIO, CHECK. Screen cap from my WndPreview class on GitHub.


I think I would change your code to first look for ENTRY with Prop:Text of ‘s’ or ‘k’. If it is ‘s’ then check the length (sub(pict,2,3)) is big enough, like >= 10. Only if the ENTRY can handle the @k### do you then look to see if Feq{PROP:Follows} (the control before that FEQ follows) is a PROMPT with Prop:Value containing Fax, Phone, Mobile.

1 Like

Oh yes, very good point!!