Author Topic: UIInput and ScrollView on Mobile  (Read 3458 times)

Tripwire

  • Full Member
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 163
    • View Profile
UIInput and ScrollView on Mobile
« on: June 02, 2014, 03:19:03 AM »
Hi,

I've upgraded to the latest version of NGUI and i'm having some problems getting my old script working again. It's used to turn off the colliders of the InputFields when scrolling in a scrollview.
The Hierarchy of my scrollview:
ScrollView
-TextBox01 (UIinput)
 -Label

When the user scrolls the scrollview on iOS or Android the touch keyboard shouldn't pop up. So I created this script:
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ClickCancel : MonoBehaviour {
  5.  
  6.         public BoxCollider col;
  7.  
  8.         public void OnDragStart()
  9.         {
  10.                 col.enabled = false;
  11.         }
  12.  
  13.         public void OnDragEnd()
  14.         {
  15.                 col.enabled = true;
  16.         }
  17. }
  18.  

But no matter what I do the TouchscreenKeyboard pops up whenever I scroll over the TextBox in my ScrollView. Any idea how to fix this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIInput and ScrollView on Mobile
« Reply #1 on: June 02, 2014, 11:04:47 PM »
In the future please stick to one thread... makes it easier. http://www.tasharen.com/forum/index.php?topic=9762.0

Tripwire

  • Full Member
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 163
    • View Profile
Re: UIInput and ScrollView on Mobile
« Reply #2 on: June 03, 2014, 03:29:16 AM »
In the future please stick to one thread... makes it easier. http://www.tasharen.com/forum/index.php?topic=9762.0

This question is not related to the bug I posted earlier, that's why I didn't make one thread.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIInput and ScrollView on Mobile
« Reply #3 on: June 04, 2014, 12:42:02 AM »
I see. So the issue is that before your script was deactivating the colliders and now it doesn't seem to as the touch screen keyboard pops up as if the collider was not getting disabled? Sounds like a script execution order issue. Before it would execute your script first, and now it executes it last. Unless you explicitly choose a script execution order for your script, its execution order is going to be undefined.

matdru

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: UIInput and ScrollView on Mobile
« Reply #4 on: June 05, 2014, 09:42:08 AM »
Or, you can try different approach that Aren suggested to me quite some time ago, which is basically about redirecting touches from inputs while dragging scrollview:

void OnDragStart (){
      UICamera.currentTouch.pressed = GameObject.Find("Dummy Placeholder");
               // or something up the hierarchy like gameObject.transform.parent.gameObject;//
}

i have this little script on all of my inputs inside scroll view and the mobile keyboard wont pop out while draging the scroll view ( altough i'm not working on latest version of ngui so i can't confirm it will work of 100% )