Page 1 of 1

is "mobile" on card

Posted: Tue Mar 17, 2015 3:59 pm
by gepponline
Hi!
I'm developing my first app for mobile...after a great sweating, now I can test my app on my mobile device.

The problem I have is that i need to create a native text input but it didn't appear, so i inserted an answer popup to debug if the opencard script was running but it seems not.

On my first card i have this code:

Code: Select all

on openCard
    if the environment is "mobile" then
      answer "mobile" 
      --crea Numero Filiera
      mobileControlCreate "input","numeroFilieraMob"
      put the rect of button "numero" into AndroNumeroFiliera
      mobileControlSet "numeroFilieraMob","rect", "130,116,354,168"
      mobileControlSet "numeroFilieraMob","keyboardtype","numeric"
   end if
end openCard
No answer pop up and no mobile control created.

So i copied the code to the stack

Code: Select all

on openStack
   set the text of field "numero" to empty
     if the environment is "mobile" then
      answer "mobile" 
      --crea Numero Filiera
      mobileControlCreate "input","numeroFilieraMob"
      put the rect of button "numero" into AndroNumeroFiliera
      mobileControlSet "numeroFilieraMob","rect", "130,116,354,168"
      mobileControlSet "numeroFilieraMob","keyboardtype","numeric"
   end if
end openStack
Now the answer popup appear but still NO input control on my app.
What's wrong with my code?

Re: is "mobile" on card

Posted: Tue Mar 17, 2015 4:08 pm
by Klaus
Hi Geppo,

I think native controls are INVISIBLE per default,
so you also need to make the control visible after creating it!
...
mobileControlSet "numeroFilieraMob","keyboardtype","numeric"
mobileControlSet "numeroFilieraMob", "visible", true
...
And yes, that surely should go into the docs! 8)


Best

Klaus

Re: is "mobile" on card

Posted: Tue Mar 17, 2015 4:14 pm
by gepponline
thank you so much :) It seems to work!
I'll be back on next issue ghgh

Re: is "mobile" on card

Posted: Tue Mar 17, 2015 4:16 pm
by gepponline
oh no..another important thing...
If i want to add 1 to the number in the mobilecontrol pressing a button
Is it correct to use

Code: Select all

 add 1 to the field "numeroFilieraMob"
or "numerofilieraMob" is not consider as a field?

Re: is "mobile" on card

Posted: Tue Mar 17, 2015 4:25 pm
by Klaus
Hi Geppo,

1. the correct syntax to access LC controls is without THE:
...
## add 1 to the fld "xyz"
add 1 to fld "xyz"
...

2. No, you are right, a native text control is NOT a LC field and you need to access it in another way.
Basically you will need to:
...
put mobilecontrolget("numeroFilieraMob", "text") into tText
add 1 to tText
mobilecontrolset "numeroFilieraMob", "text", tText
## Not tested, but should work! 8)
...

Best

Klaus

Re: is "mobile" on card

Posted: Tue Mar 17, 2015 4:29 pm
by gepponline
that's what i've done..but it seems not to work..

Code: Select all

     if the environment is "mobile" then
         put mobileControlGet ("numeroFilieraMob", "text") into lNumero
         add 1 to lNumero
         mobileControlSet "numeroFilieraMob","text",lNumero
      else       
         add 1 to the field "numero"
      end if

Re: is "mobile" on card

Posted: Tue Mar 17, 2015 4:30 pm
by gepponline
oh no!...forget about last issue..
maybe the problem was an "if" before :)

Re: is "mobile" on card

Posted: Tue Mar 17, 2015 4:47 pm
by gepponline
Here is the new issue....
The mobile control is always visible even if I change card.

So...
Is it better to HIDE the control when i change card and SHOW it when re-Open his card or I have to close and recreate it?

Re: is "mobile" on card

Posted: Tue Mar 17, 2015 5:11 pm
by Klaus
Yep, native controls "float" independently above the actual LC stack!
You can hide or delete it, its up to you :D

Re: is "mobile" on card

Posted: Tue Mar 17, 2015 9:30 pm
by Thunder
Thanks. Lots of good information here...