Author Topic: [SOLVED] Double click problem, not fast enough.  (Read 5706 times)

vexe

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 153
    • View Profile
[SOLVED] Double click problem, not fast enough.
« on: September 03, 2013, 08:02:15 AM »
Hello, I'm working on a file manager where you have files and folders and basic operations you could do on them (See attachment)

You can open a file/folder by double clicking on it, for that I'm using OnDoubleClick() event. Problem is that it's not fast enough i.e. if I click on a folder 'a', and then quickly click over another folder 'b' I open up 'b' instead! - This shouldn't happen right?

How can I get around this / fix it? - Thanks.
« Last Edit: September 05, 2013, 12:57:45 AM by vexe »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Double click problem, not fast enough.
« Reply #1 on: September 03, 2013, 09:12:46 AM »
Ah, that's actually tricky. You have to verify that it's the same object you're clicking. NGUI should do this by default, but in case it doesn't use OnClick and check for the timings yourself. Just get realtimesincestartup to calculate the difference and do your doubleclick action when it fits your threshold.

vexe

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 153
    • View Profile
Re: Double click problem, not fast enough.
« Reply #2 on: September 03, 2013, 09:33:04 AM »
Thanks for your reply. Yes, that was my 'fallback' plan, making my own double click timing.

vexe

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 153
    • View Profile
Re: Double click problem, not fast enough.
« Reply #3 on: September 03, 2013, 09:45:55 AM »
But do you know where in code, or which NGUI script has the relevant information, as to how much the time interval between the clicks?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Double click problem, not fast enough.
« Reply #4 on: September 04, 2013, 06:10:02 PM »
It's done inside UICamera.cs