Author Topic: [solved]How to get a Button click and Drag?  (Read 2239 times)

laurentl

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 188
    • View Profile
    • McDROID
[solved]How to get a Button click and Drag?
« on: April 02, 2013, 05:38:19 AM »
I have this list of buttons in a Draggable Panel.
Problem is the buttons eat the click event or the draggable panel can't differentiate between a click and a click-drag.
Is this possible to get these two to work together ?

https://www.youtube.com/watch?v=gyQ-Xowe6Rc
« Last Edit: April 12, 2013, 02:36:07 PM by Nicki »

lolonoa

  • Guest
Re: How to get a Button click and Drag?
« Reply #1 on: April 11, 2013, 10:16:06 PM »
Hi, I have the same problems here, and I might find a solution about this, but I don't understand how to do it, because I am not a proramer, here is the link http://www.tasharen.com/forum/index.php?topic=128.0, GavinF gives two ways to solve that, and it has something to do with the UIEventlistener, but I can't know how to do that, if you get it done, just give me a hand out of this, thank you.

lolonoa

  • Guest
Re: How to get a Button click and Drag?
« Reply #2 on: April 11, 2013, 10:25:58 PM »
I think I found a way to make this right, you have to attach the UIDragpanel content script to you button, that should work, I use this to solve my problems, hope you can get it solved

laurentl

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 188
    • View Profile
    • McDROID
Re: How to get a Button click and Drag?
« Reply #3 on: April 12, 2013, 01:05:21 AM »
Yes that did work for me as well.

lolonoa

  • Guest
Re: How to get a Button click and Drag?
« Reply #4 on: April 12, 2013, 11:56:45 AM »
I am glad you get it solved ;D

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: How to get a Button click and Drag?
« Reply #5 on: April 12, 2013, 02:35:48 PM »
Remember that the events are sent to all components of the gameobject with the collider you hit. That means that all of your components will get a OnPress, OnClick, OnDrag etc.

Multiple components won't interfere with each other.