Detect focus on native control
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Detect focus on native control
Is it possible to detect that an android app user has moved the focus to a native text control? I cannot see any way of doing this.
Re: Detect focus on native control
This is my solution:
########CODE#######
on InputbeginEditing
set the spostacontrollo of me to empty
put mobilecontroltarget() into nomec #control name
put mobilecontrolget(nomec,"rect") into rectc #control rect
#check if a native control is visible
#corner top left
put item 1 to 2 of rectc into altosx #corner bottom rigth
put item 3 to 4 of rectc into bassodx #angolo alto
if (altosx is not within the effective working screenrect) or (bassodx is not within the effective working screenrect) then
set the spostacontrollo of me to (nomec & CR & rectc)
mobilecontrolset nomec,"rect",the effective working screenrect
end if
end InputbeginEditing
on inputEndEditing
riportatuttoaposto
end inputEndEditing
on riportatuttoaposto
put the spostacontrollo of me into temp
put line 1 of temp into nomec
put line 2 of temp into rectc
mobilecontrolset nomec,"rect",rectc
end riportatuttoaposto
on keyboarddeactivated
riportatuttoaposto
end keyboarddeactivated
#####END OF CODE#####
########CODE#######
on InputbeginEditing
set the spostacontrollo of me to empty
put mobilecontroltarget() into nomec #control name
put mobilecontrolget(nomec,"rect") into rectc #control rect
#check if a native control is visible
#corner top left
put item 1 to 2 of rectc into altosx #corner bottom rigth
put item 3 to 4 of rectc into bassodx #angolo alto
if (altosx is not within the effective working screenrect) or (bassodx is not within the effective working screenrect) then
set the spostacontrollo of me to (nomec & CR & rectc)
mobilecontrolset nomec,"rect",the effective working screenrect
end if
end InputbeginEditing
on inputEndEditing
riportatuttoaposto
end inputEndEditing
on riportatuttoaposto
put the spostacontrollo of me into temp
put line 1 of temp into nomec
put line 2 of temp into rectc
mobilecontrolset nomec,"rect",rectc
end riportatuttoaposto
on keyboarddeactivated
riportatuttoaposto
end keyboarddeactivated
#####END OF CODE#####
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- Posts: 92
- Joined: Thu Feb 14, 2013 7:17 pm
Re: Detect focus on native control
mikek,
If you find a solution please let me know. I want to use ask... to present a native modal and not have to require the user to finger press into the text field area before the numeric keyboard will appear. Basically to mimic IOS functionality.
If you find a solution please let me know. I want to use ask... to present a native modal and not have to require the user to finger press into the text field area before the numeric keyboard will appear. Basically to mimic IOS functionality.