Page 1 of 1

Working with sub stacks

Posted: Sun Aug 22, 2021 9:55 pm
by kdjanz
I'm working on a simple Fuel Economy app where the user needs to enter numbers. Two questions:

1. On mobile devices, the dictionary says that I can use

Code: Select all

 set the keyboardType of field "odd" to "numeric"
- but where do I put that line of script? In the openCard script? In mouseEnter?
Substack.jpg
When I am working in the IDE, I made a subStack that mimics the numeric keyboard. How do I go about calling it when I click in the field, and how do I move the entered number from the subStack back to the main stack to fill the field?

Thanks for the help!

Re: Working with sub stacks

Posted: Sun Aug 22, 2021 10:07 pm
by andresdt
Hello, I do it as follows.
It doesn't mean it's correct, but it works for me.

in the stack code

Code: Select all


on preOpenStack
...
   if the platform is in "android iphone" then
       mobileSetKeyboardDisplay "pan"
    end if
...
end preOpenStack

and in the field code use:

Code: Select all


on openField
     if the environment is "mobile" then
         mobileSetKeyboardType "numeric"
     end if
     pass openField
end openField

on keyDown theKey
   if theKey is not a number then beep
   else pass keyDown
end keyDown

Re: Working with sub stacks

Posted: Sun Aug 22, 2021 10:14 pm
by jmburnod
Hi,
I'd use a group instead a stack to do what you describe.
That is the way i choose to display a custom keyboard.
I think you may use open/close field to show/hide your custom keyboard
Best regards
Jean-Marc

Re: Working with sub stacks

Posted: Sun Aug 22, 2021 11:54 pm
by kdjanz
Thanks for the ideas. Since the keypad is already grouped, I think I will try that first as the simplest

Re: Working with sub stacks

Posted: Mon Aug 23, 2021 2:34 pm
by jmburnod
Finnaly you can test these two ways and choose the best. Depends the evolution of your app
LC is great for that.
Jean-Marc