Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: VapapeurTeam on March 14, 2013, 07:57:44 AM

Title: How to differentiate Right & Left mouse clicks on NGUi elements ?
Post by: VapapeurTeam on March 14, 2013, 07:57:44 AM
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.
Title: Re: How to differentiate Right & Left mouse clicks on NGUi elements ?
Post by: Malzbier 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
Title: Re: How to differentiate Right & Left mouse clicks on NGUi elements ?
Post by: VapapeurTeam 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.

Title: Re: How to differentiate Right & Left mouse clicks on NGUi elements ?
Post by: VapapeurTeam on March 15, 2013, 03:28:15 AM
Any ideas ?

Thanks in advance.
Title: Re: How to differentiate Right & Left mouse clicks on NGUi elements ?
Post by: ArenMook on March 16, 2013, 11:11:09 AM
You can't do it without modifying NGUI's code.
Title: Re: How to differentiate Right & Left mouse clicks on NGUi elements ?
Post by: VapapeurTeam 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 ?