Jump to content

How can I detect a right click vs a left click on the stock toolbar?


linuxgurugamer

Recommended Posts

Rather then linking directly to the method you need to execute in the ApplicationLauncher.AddButton method, link to a middle-man method:


public void onStockToolbarClick()
{
if (Input.GetMouseButtonUp(1))
{
onRightButtonStockClick();
}
else
{
onLeftButtonClick();
}
}

Note this code snippet only checks for right-click, if any other mouse button is pressed (such as middle mouse button), the onLeftButtonClick(); method would execute.

I'm pretty sure mouse button 0 is left-click, 1 is right-click. I think 2 is middle mouse with 3 and 4 being the side buttons if the mouse has them.

D.

Link to comment
Share on other sites

Rather then linking directly to the method you need to execute in the ApplicationLauncher.AddButton method, link to a middle-man method:


public void onStockToolbarClick()
{
if (Input.GetMouseButtonUp(1))
{
onRightButtonStockClick();
}
else
{
onLeftButtonClick();
}
}

Note this code snippet only checks for right-click, if any other mouse button is pressed (such as middle mouse button), the onLeftButtonClick(); method would execute.

I'm pretty sure mouse button 0 is left-click, 1 is right-click. I think 2 is middle mouse with 3 and 4 being the side buttons if the mouse has them.

D.

Thank you!

LGG

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...