Page 1 of 1

Numeric Entry Keypad

Posted: Fri Mar 07, 2025 10:23 pm
by matalog
I have asked before, and just checking, there is no way to access this type of numeric keypad from SpiderBasic?

Image

Re: Numeric Entry Keypad

Posted: Sat Mar 08, 2025 2:39 pm
by hoerbie
Sorry, but there is no pic, so maybe I'm wrong.

But if you want to open a special keypad on a mobile phone when clicking into a StringGadget, on Android a function like this works, if you call it with the ID-number of the StringGadget:

Code: Select all

Procedure SetStringGadgetKeyboard(id.i, kbdt.u)
  If kbdt = 1
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','decimal');
  ElseIf kbdt = 2
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','numeric');
  ElseIf kbdt = 3
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','email');
  Else
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','text');
  EndIf
EndProcedure

Re: Numeric Entry Keypad

Posted: Sat Mar 08, 2025 5:37 pm
by Quin
hoerbie wrote: Sat Mar 08, 2025 2:39 pm Sorry, but there is no pic, so maybe I'm wrong.

But if you want to open a special keypad on a mobile phone when clicking into a StringGadget, on Android a function like this works, if you call it with the ID-number of the StringGadget:

Code: Select all

Procedure SetStringGadgetKeyboard(id.i, kbdt.u)
  If kbdt = 1
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','decimal');
  ElseIf kbdt = 2
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','numeric');
  ElseIf kbdt = 3
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','email');
  Else
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','text');
  EndIf
EndProcedure
Whoa, now that's a cool trick. I'm not OP, but it works here, thanks for sharing!

Re: Numeric Entry Keypad

Posted: Sat Mar 08, 2025 6:53 pm
by matalog
hoerbie wrote: Sat Mar 08, 2025 2:39 pm Sorry, but there is no pic, so maybe I'm wrong.

But if you want to open a special keypad on a mobile phone when clicking into a StringGadget, on Android a function like this works, if you call it with the ID-number of the StringGadget:

Code: Select all

Procedure SetStringGadgetKeyboard(id.i, kbdt.u)
  If kbdt = 1
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','decimal');
  ElseIf kbdt = 2
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','numeric');
  ElseIf kbdt = 3
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','email');
  Else
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','text');
  EndIf
EndProcedure
That's amazing thatnk for sharing it. Are there any other input options?

Re: Numeric Entry Keypad

Posted: Sun Mar 09, 2025 5:39 pm
by hoerbie
It's my pleasure to share...
The above was what I needed for my app, but some googling will give more types, for example
https://developer.mozilla.org/en-US/doc ... /inputmode
https://css-tricks.com/everything-you-e ... inputmode/
You will have to find out, what really works with different Android oder iOS versions and their different keypads. I use a lot devices from Sunmi, there are some cheap ones with Android 7.1, there you need to install a software keypad, for example GBoard from Google, to let the input mode work, on more expensive newer one with Android >= 9 the above types work.

Re: Numeric Entry Keypad

Posted: Sun Mar 09, 2025 8:45 pm
by matalog
Absolutely brilliant. Thank you.