Page 1 of 1

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

Posted: Mon Mar 15, 2021 8:31 pm
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

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

Posted: Mon Mar 15, 2021 9:02 pm
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

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

Posted: Mon Mar 15, 2021 10:16 pm
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

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

Posted: Tue Mar 16, 2021 6:11 pm
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.

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

Posted: Tue Mar 16, 2021 6:34 pm
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

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

Posted: Thu Mar 18, 2021 11:12 am
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.

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

Posted: Thu Mar 18, 2021 11:23 am
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?

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

Posted: Thu Mar 18, 2021 5:22 pm
by jacque
If rawKeyDown reports a key code then you should be able to use it in your own handler.

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

Posted: Thu Mar 18, 2021 6:43 pm
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

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

Posted: Thu Mar 18, 2021 7:25 pm
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)

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

Posted: Thu Mar 18, 2021 8:01 pm
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

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

Posted: Thu Mar 18, 2021 8:18 pm
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

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

Posted: Thu Mar 18, 2021 9:40 pm
by richmond62
so it seems that LC already can detect up to button #9
Not on Linux or Mac.

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

Posted: Fri Mar 19, 2021 9:18 am
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)

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

Posted: Fri Mar 19, 2021 8:29 pm
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)