mouseDoubleDown Problems

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
johnmiller1950
Posts: 113
Joined: Mon Apr 30, 2007 3:33 pm
Location: Dalton, Ohio

mouseDoubleDown Problems

Post by johnmiller1950 » Mon May 07, 2007 10:47 am

Greeting All,

I am updating a program that I originally wrote using Revolution 2.2.1.

In a list field, a mouseDoubleDown first sends a mouseUp and then the mouseDoubleDown.

Under 2.7.4, it is sending a mouseUp, a mousedoubledown, and then another mouseUp. This is causing problems.

Does anyone know how to get around this problem?


Thanks,
John Miller

xApple
Posts: 113
Joined: Wed Nov 29, 2006 10:21 pm
Location: Geneva

Post by xApple » Mon May 07, 2007 7:10 pm

Make a variable that counts the number of "MouseUp" and discards the second one. Not much of a solution, I know : )

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon May 07, 2007 8:45 pm

Hi John,

A similar problem has been reported to the QC already. You might want to post a comment.

http://quality.runrev.com/qacenter/show_bug.cgi?id=4610

If you comment on the bug, it might be helpful if you added a more elaborate explanation together with your scripts.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

trevix
Posts: 960
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

MouseDoubleDown Problems

Post by trevix » Fri Jan 18, 2008 5:47 pm

On OSX 10.4.9 I also noticed that if you doubleckick too fast, or as fast as you would usually do on any application, no MouseDoubleDown (or MouseDoubleUp) get sent. You must do it slowly in order to work (or you get just down and up).
Is there a way to solve this problem ?
Regards

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9837
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Post by FourthWorld » Fri Jan 18, 2008 7:39 pm

Are you sure you want mouseDoubleDown rather than mouseDoubleUp?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trevix
Posts: 960
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Post by trevix » Sat Jan 19, 2008 12:39 am

It does not really matter... I've put MouseDoubleUp with the same result and I dont see the differences between the two (the docs does not mention any differences...).
One result I've obtained, is putting a "wait 100 milliseconds with messages" on the mouseDown and checking the statements called by the MouseDown for a mouse up.
If the mouse is up then exit mousedown
In this wait the MouseDoubleUp (or Down) answers right away perhaps because it does not follow all the lines called by the mousedown.
I may have resolved it.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9837
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Post by FourthWorld » Sat Jan 19, 2008 10:48 pm

trevix wrote:It does not really matter...
It just might. While I've only been working with this language for 12 years, in that short time I've helped a few people find acceptable workarounds for things not too different from this.

Could I trouble you to describe what it is your UI does?
And how closely does your setup match the one described in the recipe for the above-referenced bug report?

And for the others here: Why do you suppose that bug report has zero votes? Did the original author find a workaround? Is the circumstance needed to replicate so very specific that it doesn't affect many people?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trevix
Posts: 960
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

MouseDoubleDown ProblemsLet'see if I can explain:

Post by trevix » Sun Jan 20, 2008 2:02 pm

Let'see if I can explain:
I'm making a classic calendar, where appointment rettangles (made with fields), strech vertically on the hours and are positioned on the days of the week.

- When I doubleclick the field, it opens up a dialog with the details of the appointement.
- When I hold down the mouse on the field, I can drag it around to reposition it on the week.

What it appens (I think) is that if I double click at normal speed (my normal speed), the script first follows the MouseUp, then the MouseDown (I know...it is strange, should be reverse) then it looks like is too late to catch the DoubleClick...so it just do another MouseUp and mouseDown(I've tracked it). This does not happen if I doubleClick slowly (it tracks as a Up, Down and Double).

I must say that each MouseUp and MouseDown on the field, continue on the stack with long script. That's why I tried to stop them putting on the MouseDown script a "if the mouse is up then exit mousedown".

My feeling is that the MouseDoubleUp should reset whatever came before...
Hope I was clear. Thanks for any help.

Trevix

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Jan 20, 2008 2:39 pm

Trevix,

Are you saying that if you double-click, both the mouseDoubleClick and the mouseUp messages are sent?

This shouldn't happen according to the docs:

"If the click is the second click of a double click, the mouseDoubleUp message is sent instead of mouseUp."

However, it does happen and I believe it should be fixed. You might want to vote for (or maybe I should say against) this bug:

http://quality.runrev.com/qacenter/show_bug.cgi?id=3567

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

trevix
Posts: 960
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Post by trevix » Sun Jan 20, 2008 4:01 pm

Exactely.
Make a locked field with this:

Code: Select all

on mousedown
  FromMouseDown
end mousedown

on mouseup
  FromMouseup
end mouseup

on MouseDoubleUp
  FromMouseDoubleUp
end MouseDoubleUp
Then put this in the stack:

Code: Select all

on FromMousedown
  --wait 1 seconds with messages
  put "FromMousedown" & return after msg
end FromMousedown

on FromMouseup
  --wait 1 seconds with messages
  put "FromMouseup" & return after msg
end FromMouseup

on FromMouseDoubleUp
  --wait 1 seconds with messages
  put "MouseDoubleUp" & return after msg
end FromMouseDoubleUp
Interesting enough, if you use the 1 seconds delay, no doubleclick get sent anymore. This should not be because if you have a complex enough MouseDown script, the MouseDoubleUp behaves randomly.

I'm not sure I understand the "quality control center" stuff enough to post anything.
Anyway the MouseDoubleDown should flush everything from the mouseDown and MouseUp...My 50 milliseconds delay is not a great solution since you feel the delay on the mouse...

Regards
Trevix

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9837
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Post by FourthWorld » Sun Jan 20, 2008 11:30 pm

If you could create the simplest possible example stack which illustrates this issue, I'd be happy to dig into it and see if I could coerce it to do what you want.

In the meantime, if all else fails there may be a way to use the flushEvents function to purge unwanted messages....
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trevix
Posts: 960
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

MouseDoubleDown Problems

Post by trevix » Tue Jan 22, 2008 10:44 am

You are very kind. My stack is complex and it's hard to simplify it. But the main point is that MouseDoubleDown does not work consistently...
try this:
on a locked fld:

Code: Select all

on mousedown
  FromMouseDown
end mousedown

on mouseup
  FromMouseup
end mouseup

on MouseDoubleUp
  --get flushEvents("all")
  FromMouseDoubleUp
end MouseDoubleUp
on the stack:

Code: Select all

on FromMousedown
  repeat with i= 1 to 1000000
    put "FromMousedown" & return into FromClick
    --if the mouse is up then exit repeat
  end repeat
  put FromClick after msg
end FromMousedown

on FromMouseup
  repeat with i= 1 to 1000000
    put "FromMouseup" & return into FromClick
    --if the mouse is down then exit repeat
  end repeat
  put FromClick after msg
end FromMouseup

on FromMouseDoubleUp
  repeat with i= 1 to 1000
    put "MouseDoubleUp" & return into FromClick
  end repeat
  put FromClick after msg
end FromMouseDoubleUp
You'll see that the FlushEvents("all") does nothing and that intercepting ("if the mouse is up...") MouseDown or MouseUp, makes them no to work.
The point is that there should be a simple way to stop mouseDown and MouseUp script when you doubleclick...

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9837
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Post by FourthWorld » Tue Jan 22, 2008 9:56 pm

> The point is that there should be a simple way to stop mouseDown
> and MouseUp script when you doubleclick...

Thanks for the explanation.

The problem, if we can call it that, is that the mouse does go down and up prior to a mouseDoubleUp, so the messages appear to be firing correctly.

In my own UIs I generally want the mouseUp in addition to mouseDoubleUp. What is your UI doing that makes this problematic?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trevix
Posts: 960
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Post by trevix » Wed Jan 23, 2008 1:39 pm

As from my first post (18 gen):
I the mouseDown and MouseUp script are long and complex, often the mousedoubleup does not work. Or it works only if you doubleclick slowly...

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Post by trevordevore » Thu Jan 24, 2008 8:07 pm

Since you mention that your mouseDown/mouseUp scripts are long and complex it may be possible that the scripts haven't finished running yet and that is interfering with the mouseDoubleUp message. I'm just guessing here as I don't know if that is possible.

In any case, what if you tried something like this:

Code: Select all

on mouseUp
    send "PerformLongAndComplexHandler" to me in 0 seconds
end mouseUp


on mouseDown
    send "PerformOtherLongAndComplexHandler" to me in 0 seconds
end mouseDown


on mouseDoubleUp
    send "PerformDoubleUpAction" to me in 0 seconds
end mouseDoubleUp

The idea here is that you end up executing the scripts directly after the engine events mouseUp/mouseDown. Perhaps this will allow mouseDoubleUp to get called correctly each time.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

Post Reply

Return to “Talking LiveCode”