Welcome,
Guest
. Please
login
or
register
.
May 27, 2026, 04:05:55 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
UIInput on canceled event
« previous
next »
Print
Pages: [
1
]
Author
Topic: UIInput on canceled event (Read 3438 times)
jindave
Newbie
Thank You
-Given: 2
-Receive: 0
Posts: 6
UIInput on canceled event
«
on:
June 25, 2014, 05:25:35 AM »
Hello Tasharen team,
I found that I often need to handle situation when mobile keyboard was canceled by user (He touched outside of keyboard). You reset the state like this:
Update function:
if
(
!
mKeyboard
.
wasCanceled
)
Submit
(
)
;
mKeyboard
=
null
;
isSelected
=
false
;
mCached
=
""
;
I did small update which I guess can be handy for all:
Event declaration:
public
List
<
EventDelegate
>
onCanceled
=
new
List
<
EventDelegate
>
(
)
;
Update function:
if
(
!
mKeyboard
.
wasCanceled
)
Submit
(
)
;
else
Canceled
(
)
;
mKeyboard
=
null
;
isSelected
=
false
;
mCached
=
""
;
Canceled function:
public
void
Canceled
(
)
{
if
(
NGUITools
.
GetActive
(
this
)
)
{
if
(
current
==
null
)
{
current
=
this
;
EventDelegate
.
Execute
(
onCanceled
)
;
current
=
null
;
}
}
}
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: UIInput on canceled event
«
Reply #1 on:
June 25, 2014, 06:29:49 AM »
You will get OnSelect(false) when you cancel it. Another advantage of OnSelect(false) is that it will work with more than just mobile keyboards -- stand-alone builds also send out OnSelect(false) when you click somewhere else.
Logged
jindave
Newbie
Thank You
-Given: 2
-Receive: 0
Posts: 6
Re: UIInput on canceled event
«
Reply #2 on:
June 25, 2014, 07:00:43 AM »
Thanks for clarification!
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
UIInput on canceled event