text not entering fields

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

cusingerBUSCw5N
Posts: 339
Joined: Wed Jul 11, 2012 9:24 pm

Re: text not entering fields

Post by cusingerBUSCw5N » Fri Sep 21, 2012 12:04 am

Their workaround doesn't work - so I've put in another request for help. Any script that I put in the input field doesn't register on mouseup (on the Android device) - even if I put answer "hi"

on mouseUp
put "input" into tControlType
mobileControlCreate tControlType, "myFirstInputField"
mobileControlSet "myFirstInputField", "visible", true mobileControlSet "myFirstInputField", "rect", "50,50,500,500"
end mouseUp


Inputting text still works fine on my computer... but the answer "hi" doesn't fire on my computer either.
:cry:

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: text not entering fields

Post by sturgis » Fri Sep 21, 2012 12:09 am

Not sure about all the other stuff going on, but a mouseup script in a livcode field that is unlock never fires. If the field is locked then it does. Clicks on an unlocked field (or touches) focus the field and set the insertion point.
cusingerBUSCw5N wrote:Their workaround doesn't work - so I've put in another request for help. Any script that I put in the input field doesn't register on mouseup (on the Android device) - even if I put answer "hi"

cusingerBUSCw5N
Posts: 339
Joined: Wed Jul 11, 2012 9:24 pm

Re: text not entering fields

Post by cusingerBUSCw5N » Fri Sep 21, 2012 2:16 pm

Thanks...I locked the field and yes, it does work now - in a weird way. It creates new field and text is put in there - but you have to tap my field first, then tap the new field and type... Also, you have to set a specific rect, which may vary based on the device size.

Can't it just type in the field I created? (I already created myFirstInputField.... - it created a second one)

Here's the code

Code: Select all

on MouseUp
put "input" into tControlType
mobileControlCreate tControlType, "myFirstInputField"
mobileControlSet "myFirstInputField", "visible", true 
mobileControlSet "myFirstInputField", "rect", "50,50,100,100"

end mouseUP
I want this bug to go away...

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: text not entering fields

Post by sturgis » Fri Sep 21, 2012 2:31 pm

I think there is some confusion going on here.

First, I don't know why the LC field isn't letting you type into it, I've had no problems with that.

Second, the native field. It has nothing to do with the field you placed on the screen in the ide. (if I understand correctly)

To do what I think you want to do, put your script into preopencard. The card opens, the field is there ready to use. You don't want to be creating a new one every time you click the field.

Then destroy it in closecard.

I haven't actually messed with the native fields, so there is a chance i'm completely and totally wrong, so do some experimentation and make sure i'm not off base.

I guess you could do it a different way. Create your layout in the ide, then when you click it, create a native field that overlays the locked field you just clicked. When done editing in the native field, put its contents in your locked field and destroy the native. No clue what the best method would be, I've had good luck with the non-native fields (I do very uncomplicated stuff so far) and the lc fields have been serving me well.

cusingerBUSCw5N
Posts: 339
Joined: Wed Jul 11, 2012 9:24 pm

Re: text not entering fields

Post by cusingerBUSCw5N » Fri Sep 21, 2012 3:57 pm

My stupidity. Yes, I put it in preopencard and it works just fine.

I would love to know that this work on an android with auto-suggestion keyboards - I've tested it on a couple with just one field, and it won't type. Tech support has said that it's a bug, it's not me.....

anyway, there is hope because there is a workaround. Now I have to do script so it if is mobile, it does my workaround...if it isn't, it just has fields...

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: text not entering fields

Post by sturgis » Fri Sep 21, 2012 4:06 pm

That should be easy enough to do. You can use "the environement" and a few other things to determine where you are running.

if the environment is "mobile" then
do mobile stuff
else
#do non-mobile stuff
end if

Or a switch statement

switch the environment
case "mobile"
#do mobile stuff
break
case "development"
#only do this stuff while in the ide
break
end switch

cusingerBUSCw5N
Posts: 339
Joined: Wed Jul 11, 2012 9:24 pm

Re: text not entering fields

Post by cusingerBUSCw5N » Mon Sep 24, 2012 12:31 am

One step forward, 3/4 steps back....

Here is the workaround code that sets up a field that can be typed in:

Code: Select all

 if the environment is "mobile" then
       put "input" into tControlType
mobileControlCreate tControlType, "myFirstInputField"
mobileControlSet "myFirstInputField", "visible", true 
mobileControlSet "myFirstInputField", "rect", "50,50,100,100"
mobileControlCreate tControlType, "mysecondInputField"
mobileControlSet "mysecondInputField", "visible", true 
mobileControlSet "mysecondInputField", "rect", "150,150,400,400"
set the vis of field "password" of this card to false
end if
Before I had this problem, my field's location was set in layout using this code:

set the top of field "password" of me to the bottom of field "label_getdocs" + tverticalspace

but the new workaround uses a rect...and so when I tried:

set the top of field "myFirstInputField" of me to the bottom of field "label_getdocs" + tverticalspace
it failed.

set the rect of field "myFirstInputField" of me to the rect of field "password"
also failed


Because the device size will vary, setting a specific rect, like "50,50,150,150" won't work.


So...how do I set it up so it resizes and repositions itself with the other items in the stack?

Also, I need a way that Livecode recognizes that this is a field - so I can call its contents. I'm not sure it understands field "myFirstInputField"

Thanks...

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: text not entering fields

Post by Klaus » Mon Sep 24, 2012 12:03 pm

Hi,

1. it is really about time that you look up some basic mobile features in the "Release Notes"!

2. "myFirstInputField" if of course no Livecode object that you can control with the regular Liveocde syntax

3. "myFirstInputField" is a native ANDROID control that has been created on the fly with YOUR script above

4. you can only use the syntax supplied by Livecode to control these native objects, so if you can only set its RECT
then you need to compute that rect somehow, which should be a snap, since you know your layout, don't you?!

5.
Also, I need a way that Livecode recognizes that this is a field - so I can call its contents.
You can GET almost everything that you can SET, see 1.:
...
put mobilecontrolGet("myFirstInputField","text") into tUserEnteredText
## do something with tUserEnteredText
...


Best

Klaus

cusingerBUSCw5N
Posts: 339
Joined: Wed Jul 11, 2012 9:24 pm

Re: text not entering fields

Post by cusingerBUSCw5N » Tue Sep 25, 2012 2:55 pm

Thanks. I have been using the Android Developer notes...Unfortunately, there are two paragraphs and no examples. Anyway, I have solved the placement of the new fields, because after I set the original fields and make them visible=false for mobile environment, then I set the rect of my new field to match the original ones. Here is the code I use:

Code: Select all

  set the top of field "title" of me to the bottom of  image "top_background7.png" of me + tVerticalSpace*2
   set the width of field "title" of me to (tStackWidth * 0.70)
   set the left of field "title" of me to tStackWidth*0.15
   
   if the environment is "mobile" then
      mobileControlSet "myseventhInputField", "rect", the rect of fld "title"
      end if
I have solved the getting data out of the new fields with this code:

Code: Select all

if the environment is "mobile" then
       put mobileControlGet(myfirstinputfield, text) into temail
         else
            put field "email_address" of this card into temail
            end if


I have also killed the mobilecontrols on card close:

Code: Select all

if the environment is "mobile" then
      mobileControlDelete myseventhInputField
      mobileControlDelete myeighthInputField
   end if
I have a couple of issues connected with multiline mobilecontrols, but I am going to put them in a separate question so that people can find them.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: text not entering fields

Post by Klaus » Tue Sep 25, 2012 3:01 pm

Please do ALWAYS use quotes here:
...
put mobileControlGet("myfirstinputfield", "text") into temail
...
mobileControlDelete "myseventhInputField"
mobileControlDelete "myeighthInputField"
...

Post Reply

Return to “Android Deployment”