TouchScreen Dial Keypad

For general Flowcode discussion that does not belong in the other sections.
Post Reply
daddytims_tims
Posts: 77
http://meble-kuchenne.info.pl
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 126 times
Been thanked: 13 times

Flowcode v10 TouchScreen Dial Keypad

Post by daddytims_tims »

Hi

Good morning

I am having a small problem with, figuring out how can I get my keypad to dial 7-digit numbers then initialized a call

In my current program;
If I press "#" ALONE it sends off and makes a call
If I dial any 1 or up to 6-digit numbers, it sends off and makes a call

What I want is Only when I Reach 7 digits Then that's the time it should make a call.

Any Help? Please and thank you.

Regards
Attachments
Esp32_KEYPAD.fcfx
(83.97 KiB) Downloaded 8 times
(view online)

mnfisher
Valued Contributor
Posts: 2185
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 177 times
Been thanked: 1026 times

Re: TouchScreen Dial Keypad

Post by mnfisher »

Assuming '#' is widget 12 - you have if widgetpressesd = 12 ... cmd = ATD876 + tmpstr.+ "\r\n" - which I'd guess does dial.

You perhaps want to add a check that tmpstr contains sufficient digits for a valid number (if (widgetpressed == 12) && (Length$(tempstr) == 7))) then dial...

or Length$(tempstr) >= 7 - to allow for longer strings - although you might want to truncate - or throw an error if tempstr has more than 7 digits?

Martin

daddytims_tims
Posts: 77
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 126 times
Been thanked: 13 times

Re: TouchScreen Dial Keypad

Post by daddytims_tims »

Hi Martin,

Goodmorning.

Thanks for your help.
The first one works great for me..

I prefer for it to be exact 7 as i already have the area code inside the prgramm already...

So how do I set it to be. If greater than 7. Throw in an error ?

Regards

mnfisher
Valued Contributor
Posts: 2185
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 177 times
Been thanked: 1026 times

Re: TouchScreen Dial Keypad

Post by mnfisher »

Glad it worked.

As to an error - depends how you want to handle it - for example you could ignore digits after 7 have been entered.

Or - better:

You could alert the user - display an error message (invalid phone number?) - similarly - if the user presses '#' before sufficient digits - display - "invalid number please enter 7 digits"

Martin

daddytims_tims
Posts: 77
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 126 times
Been thanked: 13 times

Re: TouchScreen Dial Keypad

Post by daddytims_tims »

Thats awsome. I would prefer the second option.
How can I set that up?.


Regards

mnfisher
Valued Contributor
Posts: 2185
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 177 times
Been thanked: 1026 times

Re: TouchScreen Dial Keypad

Post by mnfisher »

I'm not at a computer - but.

Something like:

Add a macro Dial(string number)

Then in your loop - if (widgetoressed ==12) Dial(tmpstr)

In Dial (number)
.len = LengthStr$(.number)
if(.len != 7) Message("Invalid number - please enter 7 digits)
else
.msg = "Dialling " + .number
Message(.msg)
.... do the call ATD....
Message("Hanging up")

etc

Post Reply