Page 1 of 1

MouseUp or MouseDown?

Posted: Thu Jun 07, 2018 10:33 pm
by RossG
I've long been intrigued by the default
"on mouseUp" since "on mouseDown" seems
more intuitive and I've recently found that
in some cases "mouseDown" works better.

Is there some history in the use of "mouseUp"?

Re: MouseUp or MouseDown?

Posted: Fri Jun 08, 2018 12:53 am
by FourthWorld
With push buttons on most OSes, the release of the mouse is the action trigger. Your can observe this by clicking down on a push button, and while the mouse is still down, drag off the button to release.

Re: MouseUp or MouseDown?

Posted: Fri Jun 08, 2018 3:23 am
by dunbarx
What Richard said, in terms of "normal" UI expectations. If you play around with any of your other favorite apps, you will probably see that it is "up" where the actual instant of action occurs.

But this is academic. LC offers it all, including "mouseWithin" and "mouseStillDown"

Craig Newman

Re: MouseUp or MouseDown?

Posted: Fri Jun 08, 2018 4:54 pm
by jacque
The reason all OSs use mouseUp by default is to allow the user to cancel the button press by dragging outside the control before release. It's a handy convention when you change your mind in the middle of a click.

Re: MouseUp or MouseDown?

Posted: Fri Jun 08, 2018 9:38 pm
by RossG
I can't recall ever changing my mind mid-click
but perhaps one day...

Don't see anything in the Dictionary about
using left or right (or middle) mouse button.
Have I missed something?

Re: MouseUp or MouseDown?

Posted: Fri Jun 08, 2018 9:54 pm
by Klaus
RossG wrote:
Fri Jun 08, 2018 9:38 pm
Don't see anything in the Dictionary about
using left or right (or middle) mouse button.
Standard click behaviour:
Usually what we call a "simple" click is a left-click.
Right-clicks usually evokes a popup menu of some sort (context menu).
But you can of course script what you like!

If you omit the "pMouseButton" parameter i a "mouseup/down" handler then a left-click is presumed by the engine.

Parameter for "mouseup/down" handler:
1 = left click
2 = middle click, which most "mouses" do not have
3 = right-click

Examples:

Code: Select all

on mousedown pMousebutton
  if pMouseButton = 3 then
    popup btn "my popup menu" at the mouseloc
  end if
end mousedown

Code: Select all

on mouseup
  ## Same as -> on mouseup 1
  beep
end mouseup
Check the "mouseup" entry in the dictionary for more interesting stuff... 8)

Re: MouseUp or MouseDown?

Posted: Fri Jun 08, 2018 9:58 pm
by jmburnod
Hi Ross,
There is a something about that in LC dictionary at "mouseup" entry

Edit: I tried to delete my this post with a comment "Herr Major was faster than me" and I got this message: "Sorry but you may only delete posts which have not been replied to."
Something change about delete message ?
Best regards
Jean-Marc

Re: MouseUp or MouseDown?

Posted: Fri Jun 08, 2018 9:58 pm
by FourthWorld
RossG wrote:
Fri Jun 08, 2018 9:38 pm
Don't see anything in the Dictionary about
using left or right (or middle) mouse button.
Have I missed something?
In the Dictionary entries for most mouse-related messages (mouseDown, mouseUp, mouseDoubleDown, etc.) you'll see an argument passed with the message identified as mouseButtonNumber. Just below in the "Parameters" section you'll find the discussion of how the integer passed there reflects the button number: 1 for left-click, 2 for middle-click (though not as common outside of Unix where three-button mice are the standard), and 3 for right-click.

Re: MouseUp or MouseDown?

Posted: Sat Jun 09, 2018 7:36 am
by richmond62
I was merrily using mouseDown all the time in 2004 until Klaus
pointed out that by using mouseUp the end-user gets
a chance to change her mind by sliding her mouse pointer off the object
before releasing it.

It is also useful in this sort of scenario (pseudocode):

on mouseDown
do one action
end mouseDown

on mouseUp
perform another action
end mouseUp


and, in my case, more specifically (real code):

Code: Select all

on keyDown KD
  put (KD && "= ") into fld "fKEY"
end keyDown

on rawKeyUp RK
  put RK after fld "fKEY"
end rawKeyUp
8)

Re: MouseUp or MouseDown?

Posted: Sat Jun 09, 2018 10:51 pm
by RossG
Regarding "on mouseUp" allowing the user to
change his/her mind before releasing the
button isn't it normal for a programme to
allow the user to "undo" a wrong click?

So I find the argument for "on mouseUp" is
pretty feeble.

Re: MouseUp or MouseDown?

Posted: Sun Jun 10, 2018 1:09 am
by dunbarx
"Undo" is invaluable.

Moving the mouse off the target while still down to cancel an errant or mistaken click. priceless.

Craig

Re: MouseUp or MouseDown?

Posted: Sun Jun 10, 2018 7:58 am
by richmond62
isn't it normal for a programme to
allow the user to "undo" a wrong click?
It should be: but I, for one, don't know how one sets up code
in LiveCode so every mouseclick is undoable after the click.

Re: MouseUp or MouseDown?

Posted: Sun Jun 10, 2018 11:50 am
by FourthWorld
richmond62 wrote:
Sun Jun 10, 2018 7:58 am
isn't it normal for a programme to
allow the user to "undo" a wrong click?
It should be: but I, for one, don't know how one sets up code
in LiveCode so every mouseclick is undoable after the click.
By using mouseUp instead of mouseDown.

Re: MouseUp or MouseDown?

Posted: Sun Jun 10, 2018 3:35 pm
by richmond62
By using mouseUp instead of mouseDown
Really? Gosh? Wow? I would never have guessed. 8)

Some other people in this discussion seem not to have got "there" either.

Re: MouseUp or MouseDown?

Posted: Sun Jun 10, 2018 4:27 pm
by jacque
RossG wrote:
Sat Jun 09, 2018 10:51 pm
Regarding "on mouseUp" allowing the user to
change his/her mind before releasing the
button isn't it normal for a programme to
allow the user to "undo" a wrong click?

So I find the argument for "on mouseUp" is
pretty feeble.
It's actually a documented behavior in Apple's Human Interface Guidelines from back when it created the earliest personal computers, and they gave the reason as above. This was back when Apple did extensive usability testing and developed interfaces that were later copied by Microsoft and have now become the expected standard.

While experienced users may not need the behavior as much, watch any new user learning a computer for a while, or a motor-impaired user with Parkinson's or CP. Clicks and mousing are slow, and mistaken mouse movements are common. The ability to abort an unintended gesture is useful, especially if the result would be an unwanted long process or data modification.