on mouseUp pButtonNumber "VS" on mouseUp. - ??

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm

on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by liveme »

Hi, I keep using on mouseUp pButtonNumber and on mouseUp without knowing why...

Can anyone let me quick know why/when I should use the :
- on mouseUp
versus using :
- on mouseUp pButtonNumber
and what does pButtonNumber stands for. ?

none returns any error all the time
Thanks
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by bogs »

mouseUp is a message sent when any button on the mouse is pressed, for instance if you push down the mouse wheel instead of scrolling it, it sends a mouseDown / mouseUp message.

There is a pretty good explanation of this in the dictionary under "mouseUp" or "mouseDown", including what buttons register, etc.

As far as which of those 2 ways to handle it, pButtonNumber is just a placeholder for the number (1 through 3) of the button of the mouse that came up . You could use any place holder there, I believe currently they have the handler auto insert it as 'pButtonNumber', but it could just as easily be 'x' or anything else.

put the following in a card script, then click somewhere in the card...

Code: Select all

on mouseUp x
   answer x
end mouseUp
Image
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10509
Joined: Wed May 06, 2009 2:28 pm

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by dunbarx »

What Bogs said.

The parameter "pButtonNumber" is loaded with the button number pressed, and sent as a parameter attached to the "mouse" message itself. But like all parameters, it can be either used or ignored. That is up to you.

Craig
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by jacque »

Just to add, the button number is useful if you want to know whether the click is a left or right click. If the number is 1 it's a normal left click, if it's 3 then a right click. You might want to show a menu or do another special behavior for a right click.

If I don't care which button was pressed I ignore the parameter and usually leave it out.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by richmond62 »

SShot 2021-03-16 at 19.32.48.png
-

Code: Select all

on mouseDown XXX
   switch XXX
      case "1"
         set the vis of img "LL" to true
         break
      case "2"
         set the vis of img "CC" to true
         break
      case "3"
         set the vis of img "RR" to true
         break
   end switch
end mouseDown

on mouseUp
   wait 45 ticks
   set the vis of img "LL" to false
   set the vis of img "CC" to false
   set the vis of img "RR" to false
end mouseUp
Attachments
Mouse Buttons.livecode.zip
Here's the stack.
(123 KiB) Downloaded 292 times
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by richmond62 »

What is a real pain-in-the-bum are things such as multi-button mice.
-
verticalMouse.jpeg
-
I have a few of these . . .

As well as the fairly standard 3 : Left, Right, Central Scroll wheel, it features 2 buttons in the thumb position.

These 2 extra buttons, when clicked, are not detected by LiveCode at all.

They ARE detected 'elsewhere' as I can use them to set up a rapid scroll in a web browser.
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by richmond62 »

Enhancement request submitted:

https://quality.livecode.com/show_bug.cgi?id=23127
-
960x0.jpeg
-
Wouldn't it be lovely if one could leverage those buttons in LiveCode?
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by jacque »

If rawKeyDown reports a key code then you should be able to use it in your own handler.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10509
Joined: Wed May 06, 2009 2:28 pm

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by dunbarx »

I use a multi-button mouse, and have customized it for several different apps, including LC. But not all of those buttons generate a rawKeyDown message at all.

Craig
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by richmond62 »

If rawKeyDown reports a key code then you should be able to use it in your own handler.
Well, certainly NOT the 2 extra buttons on my vertical DELUX horror. 8)

That bloody snake . . .

https://stackoverflow.com/questions/124 ... ith-python
-
SShot 2021-03-18 at 20.27.41.png
-
So . . . ?

Presumably there should be a way to detect that sort of thing in C++ . . .

Ah, X mouse buttons. 8)
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by richmond62 »

Here's the oddest thing I can find for sale round these parts (Bulgaria) . . . so, guess what I'm buying next?
-
razer naga trinity.jpg
Last edited by richmond62 on Fri Mar 19, 2021 9:13 am, edited 1 time in total.
liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by liveme »

Ahhhhhhh !!! :lol:
Thank you all for making it so clear and for the script, I've used Bogs simple mouse test on a "semi vertical" ( :mrgreen: ) NG* Evo Ergo mouse
...and glad it could indeed detect 5 out of the 6 buttons it offers, answer numbers are : 1,2,3,8,9.
so it seems that LC already can detect up to button #9..on this Logite** Mouse.

(not sure what beige button 6th is meant for : maybe just a "Bluetooth pairing" button.)

..so yeah, its probably usefull for Desktop workers to take more benefit of an APP. !

Thanks again :wink: !
evo ergo mouse.jpeg
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by richmond62 »

so it seems that LC already can detect up to button #9
Not on Linux or Mac.
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by richmond62 »

"semi vertical" ( :mrgreen: ) NG* Evo Ergo mouse
In Bulgarian:

mouse = 'mishka'

penis = 'pishka'

Just my luck when I rang up my local tech store to see if they had a vertical mouse to get the deaf lady. 8)
liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm

Re: on mouseUp pButtonNumber "VS" on mouseUp. - ??

Post by liveme »

Not on Linux or Mac.
the IDE is installed on Linux...thought ...I have not built yet the app to test the installed mouse "reaction" then... 8)
Post Reply