Welcome,
Guest
. Please
login
or
register
.
December 04, 2024, 07:27:57 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
UIInput bugs in 3.0.8f3
« previous
next »
Print
Pages:
1
[
2
]
Author
Topic: UIInput bugs in 3.0.8f3 (Read 9148 times)
schneidb
Newbie
Thank You
-Given: 2
-Receive: 2
Posts: 24
Re: UIInput bugs in 3.0.8f3
«
Reply #15 on:
March 10, 2014, 09:54:14 AM »
I should also clarify, that this also works to solve the problem we've been discussing...
if
(
string
.
IsNullOrEmpty
(
ime
)
&&
!
string
.
IsNullOrEmpty
(
Input
.
inputString
)
)
{
// Process input ignoring non-printable characters as they are not consistent.
// Windows has them, OSX may not. They get handled inside OnGUI() instead.
string
s
=
Input
.
inputString
;
for
(
int
i
=
0
;
i
<
s
.
Length
;
++
i
)
{
char
ch
=
s
[
i
]
;
if
(
ch
<
' '
)
continue
;
// OSX inserts these characters for arrow keys
if
(
ch
==
63232
)
continue
;
if
(
ch
==
63233
)
continue
;
if
(
ch
==
63234
)
continue
;
if
(
ch
==
63235
)
continue
;
Insert
(
ch
.
ToString
(
)
)
;
}
}
... but there is another problem that is only an issue in the editor that the first solution (from my previous post) also addresses. That issue is that you can use Command+p on the keyboard to play and stop in the editor. If you are in play mode in the editor while an NGUI UIInput field has focus, the 'p' part of Command+p is inserted into the field.
Logged
schneidb
Newbie
Thank You
-Given: 2
-Receive: 2
Posts: 24
Re: UIInput bugs in 3.0.8f3
«
Reply #16 on:
March 10, 2014, 04:02:48 PM »
I apologize, it would appear I'm being an idiot today as the code I proposed actually blocks all input. This does work, however...
if
(
string
.
IsNullOrEmpty
(
ime
)
&&
!
string
.
IsNullOrEmpty
(
Input
.
inputString
)
)
{
// Process input ignoring non-printable characters as they are not consistent.
// Windows has them, OSX may not. They get handled inside OnGUI() instead.
string
s
=
Input
.
inputString
;
for
(
int
i
=
0
;
i
<
s
.
Length
;
++
i
)
{
char
ch
=
s
[
i
]
;
if
(
ch
>=
' '
&&
ch
!=
63232
&&
ch
!=
63233
&&
ch
!=
63234
&&
ch
!=
63235
)
Insert
(
ch
.
ToString
(
)
)
;
}
}
Sorry about that.
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: UIInput bugs in 3.0.8f3
«
Reply #17 on:
March 10, 2014, 08:31:36 PM »
I don't see any difference between your last two functions logic-wise. The only difference is one does an equality check and the other does an inequality check.
Thinking about it, my code should have been using '\uF700' etc, as that's the correct hexadecimal representation.
if
(
string
.
IsNullOrEmpty
(
ime
)
&&
!
string
.
IsNullOrEmpty
(
Input
.
inputString
)
)
{
// Process input ignoring non-printable characters as they are not consistent.
// Windows has them, OSX may not. They get handled inside OnGUI() instead.
string
s
=
Input
.
inputString
;
for
(
int
i
=
0
;
i
<
s
.
Length
;
++
i
)
{
char
ch
=
s
[
i
]
;
if
(
ch
<
' '
)
continue
;
// OSX inserts these characters for arrow keys
if
(
ch
==
'
\u
F700'
)
continue
;
if
(
ch
==
'
\u
F701'
)
continue
;
if
(
ch
==
'
\u
F702'
)
continue
;
if
(
ch
==
'
\u
F703'
)
continue
;
Insert
(
ch
.
ToString
(
)
)
;
}
}
Logged
schneidb
Newbie
Thank You
-Given: 2
-Receive: 2
Posts: 24
Re: UIInput bugs in 3.0.8f3
«
Reply #18 on:
March 11, 2014, 04:42:02 AM »
Yes, this does indeed work. It doesn't address the command+p issue I described, but that is an Editor only issue that I can live with. Thanks!
Logged
Print
Pages:
1
[
2
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
UIInput bugs in 3.0.8f3