Distinguishing simple and double clicks
-= JB =-
sundown at pacifier.com
Tue Sep 23 19:24:14 EDT 2008
Hi Eric,
If you look at the script you might be fooled into thinking
I am checking for a mouseDown but it is the mouseUp I
was checking.
Here is why I wrote it. I was using the mouseUp and if
a person clicked on some text it would bring up a dialog
displaying the text with the line and item numbers. Then
i allowed columns to be collapsed by doubleclicking and
if a person double clicked text instead of a mouseUp it
created problems.
So I used the clickFlag to trap for the mouseUp. Now if
a person double clicks the text it will see it as a mouseUp
and work properly while if they double click white space it
will collapse the column.
As I have said the code looks like I am checking for mouse
downs when in reality even though it is in the mouseDown
handlers it is the mouseUp I was concerned about.
-=>JB<=-
On Sep 23, 2008, at 3:23 PM, -= JB =- wrote:
> Hi Eric,
>
> In the stack Dynamic Table Field I use a script the allows different
> actions for single and double mouseclicks. It uses a local variable
> clickFlag and the script mixed in a few different handlers.
>
> -=>JB<=-
>
>
>
> On Sep 23, 2008, at 6:23 AM, Eric Chatonet wrote:
>
>> Bonjour à tous,
>>
>> I just want to make something that was easy with HC: e.g. allow
>> the user to use simple and double clicks on the same button but
>> with different actions.
>> MouseUp is always sent by the engine first then mouseDoubleUp is
>> sent if appropriate.
>>
>> So the question is how to not execute a mouseUp handler if it is
>> just the first click of a double click?
>> Here is a code that allows this but:
>> It sounds a bit complicated ;-)
>> It delays mouseUp action by 500 millseconds :-(
>>
>> Any better idea?
>>
>> local sDoubleClick
>> ---------------------
>> on mouseUp
>> send "DoMouseUp" to me in 500 milliseconds
>> end mouseUp
>> ---------------------
>> on mouseDoubleUp
>> put true into sDoubleClick
>> DoMouseDoubleUp --
>> send "ResetScriptVar" to me in 500 milliseconds
>> end mouseDoubleUp
>> ---------------------
>> on DoMouseUp
>> if sDoubleClick then exit DoMouseUp
>> put "Simple Click"
>> end DoMouseUp
>> ---------------------
>> on DoMouseDoubleUp
>> put "Double Click"
>> end DoMouseDoubleUp
>> ---------------------
>> on ResetScriptVar
>> put false into sDoubleClick
>> end ResetScriptVar
>>
>> Best regards from Paris,
>> Eric Chatonet.
>> ----------------------------------------------------------------
>> Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
>> Email: eric.chatonet at sosmartsoftware.com/
>> ----------------------------------------------------------------
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list