Detect focus on native control

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mikek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3
Joined: Sat Jan 05, 2008 5:36 pm

Detect focus on native control

Post by mikek » Sat Nov 23, 2013 7:48 pm

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.

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Detect focus on native control

Post by MaxV » Sun May 03, 2015 11:02 pm

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#####
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

jekyllandhyde
Posts: 92
Joined: Thu Feb 14, 2013 7:17 pm

Re: Detect focus on native control

Post by jekyllandhyde » Mon May 04, 2015 10:30 pm

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.

Post Reply