Page 1 of 1
Widget Native Field - Andriod
Posted: Mon Nov 30, 2020 5:16 am
by lemodizon
Hello everyone,
I'm new to this widget native field just want to ask how to use it. I have to widget fields username and password I want to validate if the user entered the correct user name and password. Thanks in advance
Code: Select all
on mouseUp
inputCreate
end mouseUp
on inputCreate
if the environment is "mobile" then
mobileControlCreate "input", "UserName"
put the result into sUserName
if sUserName is "admin" then
answer "Hello admin"
else
answer "wrong username"
end if
end if
Re: Widget Native Field - Andriod
Posted: Mon Nov 30, 2020 7:11 am
by FourthWorld
Where is the password stored?
Re: Widget Native Field - Andriod
Posted: Mon Nov 30, 2020 8:01 am
by lemodizon
FourthWorld wrote: ↑Mon Nov 30, 2020 7:11 am
Where is the password stored?
I forgot to include in my code... can you teach me how to use this widget field. Thanks
Re: Widget Native Field - Andriod
Posted: Mon Nov 30, 2020 8:18 am
by FourthWorld
I know little about this widget field, but I know a thing or two about password management. Happy to help where I can.
Re: Widget Native Field - Andriod
Posted: Mon Nov 30, 2020 9:10 am
by lemodizon
FourthWorld wrote: ↑Mon Nov 30, 2020 8:18 am
I know little about this widget field, but I know a thing or two about password management. Happy to help where I can.
Hello, I just want to do in my simple app is when the user type admin and password it will go to the next card. in my code, I will assign a default username (admin) and password (12345). I noticed that there is a different approach when using the widget native field compared to a regular field. hope you can help me guys. thanks, in an advance

Re: Widget Native Field - Andriod
Posted: Mon Nov 30, 2020 3:06 pm
by lemodizon
lemodizon wrote: ↑Mon Nov 30, 2020 9:10 am
FourthWorld wrote: ↑Mon Nov 30, 2020 8:18 am
I know little about this widget field, but I know a thing or two about password management. Happy to help where I can.
Hello, I just want to do in my simple app is when the user type admin and password it will go to the next card. in my code, I will assign a default username (admin) and password (12345). I noticed that there is a different approach when using the widget native field compared to a regular field. hope you can help me guys. thanks, in an advance
Hello everyone,
Is there a bug in the widget android native field? how can I get the inputted text in this field? I don't know if I can use the field here coz there is a problem with the keyboard sometimes it doesn't appear.
Re: Widget Native Field - Andriod
Posted: Mon Nov 30, 2020 4:27 pm
by FourthWorld
Who is the intended audience for this admin feature?
Re: Widget Native Field - Andriod
Posted: Mon Nov 30, 2020 10:16 pm
by jacque
There are two ways to create an Android field. The first way is to use mobileControlCreate. The second way is to use the field widget in the tool palette which you drag onto the card. Your image looks like you are using the widget, but the code looks like you are creating a native field by script. You can't mix the two.
You need to write scripts that read the user input which you'd probably do in the Enter button. When the user taps the button, get the text of the fields and see if it is correct. The syntax is:
You can see all the messages and properties in the dictionary if you search for "Android native field".
Re: Widget Native Field - Andriod
Posted: Fri Dec 04, 2020 11:07 am
by lemodizon
jacque wrote: ↑Mon Nov 30, 2020 10:16 pm
There are two ways to create an Android field. The first way is to use mobileControlCreate. The second way is to use the field widget in the tool palette which you drag onto the card. Your image looks like you are using the widget, but the code looks like you are creating a native field by script. You can't mix the two.
You need to write scripts that read the user input which you'd probably do in the Enter button. When the user taps the button, get the text of the fields and see if it is correct. The syntax is:
You can see all the messages and properties in the dictionary if you search for "Android native field".
Hello Jacque,
Thanks for the information. most of the example I saw in the internet they are using this "mobileControlCreate". I'm trying the second way you said. Is there a example or link using this syntax in android?
Re: Widget Native Field - Andriod
Posted: Fri Dec 04, 2020 6:57 pm
by jacque
It's simple enough that I doubt there is a lesson. Drag a field widget to the card and name it "user". Drag another to the card and name it "password".
In the Enter button, create a mouseUp handler.
Code: Select all
on mouseUp
put the text of widget "user" into tUser
put the text of widget "password" into tPass
- - here, compare the values to the correct responses
- - and take action if they are correct
end mouseUp
Re: Widget Native Field - Andriod
Posted: Sat Dec 05, 2020 4:19 am
by lemodizon
jacque wrote: ↑Fri Dec 04, 2020 6:57 pm
It's simple enough that I doubt there is a lesson. Drag a field widget to the card and name it "user". Drag another to the card and name it "password".
In the Enter button, create a mouseUp handler.
Code: Select all
on mouseUp
put the text of widget "user" into tUser
put the text of widget "password" into tPass
- - here, compare the values to the correct responses
- - and take action if they are correct
end mouseUp
Hi Jacque,
there is wrong in my previous code instead "put" i typed the "get" that's why it's not working. this is now ok. Thanks again and stay safe.
Re: Widget Native Field - Andriod
Posted: Sat Dec 05, 2020 5:38 am
by jacque
Great! Good luck with your app.
Re: Widget Native Field - Andriod
Posted: Sat Dec 05, 2020 9:21 am
by lemodizon
jacque wrote: ↑Sat Dec 05, 2020 5:38 am
Great! Good luck with your app.
Hi Jacque,
How can I get the text of the datagrid going to my widget? i tried this code noting happens
Code: Select all
if EditProd is "EditProd" then
put the dgHilitedLine of group "DataProd" into tLineToEdit
if tLineToEdit is empty then
beep
Answer info "Please select a Product name to EDIT INFORMATION"
else
if tLineToEdit is a number and tLineToEdit >0 then
set the itemdel to tab
put line tLineToEdit of the dgtext of grp "DataProd" of cd "MainCard" of stack "MyAndriod" into tData
put the text item 1 of tdata into widget "ProdPrice" of cd "EditProd"
go to card "EditProd"
end if
Re: Widget Native Field - Andriod
Posted: Sat Dec 05, 2020 12:14 pm
by Klaus
Hi lemodizon,
do this:
Code: Select all
...
## If you do not have an ELSE case for this IF -> if EditProd is "EditProd" then
## you should avoid many IF THENs, this makes the script better readable!
if EditProd <> "EditProd" then
exit mouseup
## or what handler we are currently in
end if
## Now check hilite:
put the dgHilitedLine of group "DataProd" into tLineToEdit
if tLineToEdit = empty then
beep
Answer info "Please select a Product name to EDIT INFORMATION"
exit mouseup
## See above
end if
## It is easier to work with an array, since datagrids do this, too, internally!
put the dgDataOfline[tLineToEdit] of grp "DataProd" into tArray
## This array tArray has the names of the columns as its KEYS, so we can easily
put tArray["price"] into tPrice
put tArray["productname"] into tProdName
## etc. for all infos from the datagrid
## Change the name if they do not fit your column name, I am only guessing from the screenshot.
## Widget are a different beast so we need to set THE TEXT and not "put into...":
set the text of widget "ProdPrice" of cd "EditProd" to tPrice
set the text of widget "ProdName" of cd "EditProd" to tProdName
## etc. see above...
go to card "EditProd"
...
Best
Klaus
Re: Widget Native Field - Andriod
Posted: Sat Dec 12, 2020 3:52 am
by lemodizon
Klaus wrote: ↑Sat Dec 05, 2020 12:14 pm
Hi lemodizon,
do this:
Code: Select all
...
## If you do not have an ELSE case for this IF -> if EditProd is "EditProd" then
## you should avoid many IF THENs, this makes the script better readable!
if EditProd <> "EditProd" then
exit mouseup
## or what handler we are currently in
end if
## Now check hilite:
put the dgHilitedLine of group "DataProd" into tLineToEdit
if tLineToEdit = empty then
beep
Answer info "Please select a Product name to EDIT INFORMATION"
exit mouseup
## See above
end if
## It is easier to work with an array, since datagrids do this, too, internally!
put the dgDataOfline[tLineToEdit] of grp "DataProd" into tArray
## This array tArray has the names of the columns as its KEYS, so we can easily
put tArray["price"] into tPrice
put tArray["productname"] into tProdName
## etc. for all infos from the datagrid
## Change the name if they do not fit your column name, I am only guessing from the screenshot.
## Widget are a different beast so we need to set THE TEXT and not "put into...":
set the text of widget "ProdPrice" of cd "EditProd" to tPrice
set the text of widget "ProdName" of cd "EditProd" to tProdName
## etc. see above...
go to card "EditProd"
...
Best
Klaus
Hi Klaus,
Thanks, This is now ok. Stay safe.