Author Topic: How to differentiate Right & Left mouse clicks on NGUi elements ?  (Read 7383 times)

VapapeurTeam

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Hello,

It's probably a very stupid question, but I haven't figured out how to do that. I've got a UICheckbox on a game object, and the box can be checked/unchecked by clicking on it. It works with both right and left click, and I only want it to be on left clicks (right clicks would do nothing). How can I set that up ?

Thanks.

Malzbier

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 93
    • View Profile
Re: How to differentiate Right & Left mouse clicks on NGUi elements ?
« Reply #1 on: March 14, 2013, 09:00:58 AM »
Quote
Inside your event functions you can always figure out who sent the event (UICamera.currentCamera), RaycastHit that resulted in this event (UICamera.lastHit), as well as the on-screen position of the touch or mouse (UICamera.lastTouchPosition). You can also determine the ID of the touch event (UICamera.currentTouchID), which is ‘-1′ for the left mouse button, ‘-2′ for right, and ‘-3′ for middle.

http://www.tasharen.com/?page_id=160

VapapeurTeam

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: How to differentiate Right & Left mouse clicks on NGUi elements ?
« Reply #2 on: March 14, 2013, 10:41:49 AM »
Yes, but that doesn't help me in this case. I have a completely standard checkbox made of 100% NGUI scripts, which I don't want to modify, and this checkbox can be checked/unchecked by right clicks. I would like to disable right clicks on my checkboxes, without having to change the code of UICheckbox to test for left/right clicks.


VapapeurTeam

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: How to differentiate Right & Left mouse clicks on NGUi elements ?
« Reply #3 on: March 15, 2013, 03:28:15 AM »
Any ideas ?

Thanks in advance.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to differentiate Right & Left mouse clicks on NGUi elements ?
« Reply #4 on: March 16, 2013, 11:11:09 AM »
You can't do it without modifying NGUI's code.

VapapeurTeam

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: How to differentiate Right & Left mouse clicks on NGUi elements ?
« Reply #5 on: March 17, 2013, 04:57:32 AM »
Ok, thanks. I must say I'm a bit surprised this isn't something that NGUI can handle, it seems like a pretty basic feature. Do you plan to adress this issue in a later release ?