You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by andrei apostolache <ap...@gmail.com> on 2012/04/20 12:44:54 UTC

[Proposal] Different behaviour on click and doubleClick on UIComponent

Hi.

It might be a weird proposal, but in some cases you might need to have
different behavior for a button/custom component based on UIComponent for
click and double click.
An workaround will be to start a 300-400 millisecond timer in your click
handler to delay your actions (in case the user will go for a
double-click), but I think the elegant way will be that the UIComponent
should take care of this once you set on true doubleClickEnabled.

Regards,
Andrei.

Re: [Proposal] Different behaviour on click and doubleClick on UIComponent

Posted by Alex Harui <ah...@adobe.com>.


On 4/21/12 10:54 AM, "andrei apostolache" <ap...@gmail.com>
wrote:

> Doug, Alex I'm pretty sure there should be something in the UIComponent to
> make the difference between click & doubleClick event.
DoubleClick is defined on flash.display.InteractiveObject.  There is no code
in UIComponent for it.

> What I don't know for sure is why there is the
> *doubleClickEnabled*property in UIComponent. Maybe a quicker and
> simpler solution might be a
> callLater on dispatching the "click" event and a flag on "doubleClick"
> handler, if the flag is set on true on doubleClick once the callLater is
> called is just ignoring to dispatch the click event. Otherwise your
> dispatching the click event.
You are welcome to implement whatever behavior you can on top of
UIComponent, but some folks want other behavior.  We should either leave
whatever behavior the player defaults to or allow plug-in/replaceable
behavior.

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: [Proposal] Different behaviour on click and doubleClick on UIComponent

Posted by andrei apostolache <ap...@gmail.com>.
Doug, Alex I'm pretty sure there should be something in the UIComponent to
make the difference between click & doubleClick event. I didn't investigate
too much in this, it was just something that I had to deal on Friday and
wanted to see if someone else had this problem (mine was a bit more complex
that on click event the component was reposition so the double click was
impossible to be made, but also the component need different behaviour on
click & double click).
What I don't know for sure is why there is the
*doubleClickEnabled*property in UIComponent. Maybe a quicker and
simpler solution might be a
callLater on dispatching the "click" event and a flag on "doubleClick"
handler, if the flag is set on true on doubleClick once the callLater is
called is just ignoring to dispatch the click event. Otherwise your
dispatching the click event.
Of course is a simple workaround to be done and maybe a feature that is not
used by a lot of people, but won't mess with the functionality of
UIComponent, it will be available only if you set doubleClickEnabled, but I
think that UIComponent should be the class to have this because I already
had the same request on a Group, Button and on a ItemRenderer.

Regards,
Andrei.

On Fri, Apr 20, 2012 at 6:20 PM, Alex Harui <ah...@adobe.com> wrote:

>
>
>
> On 4/20/12 8:43 AM, "andrei apostolache" <ap...@gmail.com>
> wrote:
>
> > Hi Scott,
> >
> > Is not about a new component, it's about all spark components that are
> > based on UIComponent. Think for example a simple spark button, <s:Button
> > click="doSomething()" doubleClick="doSomethingElse()"
> > doubleClickEnabled="true" /> if you will try to double click the button
> > first it will trigger doSomething() and then doSomethingElse(), while the
> > expectation would be: click received (should obfuscate it for 300 ms to
> see
> > if the user is going for a double click), if second click happens trigger
> > doSomethingElse(), otherwise trigger doSomething().
> >
> These requests are why we need to find an efficient plug-in model for the
> SDK.  Then you can alter this behavior and not mess up someone who does
> need
> the click when it happens.
>
> --
> Alex Harui
> Flex SDK Team
> Adobe Systems, Inc.
> http://blogs.adobe.com/aharui
>
>

Re: [Proposal] Different behaviour on click and doubleClick on UIComponent

Posted by Duane Nickull <du...@uberity.com>.
On 12-04-20 8:48 AM, "Doug Arthur" <do...@gmail.com> wrote:

>On Fri, Apr 20, 2012 at 9:43 AM, andrei apostolache
><ap...@gmail.com> wrote:
>> Hi Scott,
>>
>> Is not about a new component, it's about all spark components that are
>> based on UIComponent. Think for example a simple spark button, <s:Button
>> click="doSomething()" doubleClick="doSomethingElse()"
>> doubleClickEnabled="true" /> if you will try to double click the button
>> first it will trigger doSomething() and then doSomethingElse(), while
>>the
>> expectation would be: click received (should obfuscate it for 300 ms to
>>see
>> if the user is going for a double click), if second click happens
>>trigger
>> doSomethingElse(), otherwise trigger doSomething().
>
>The problem you have with a timer, is the speed at wich individuals
>set their double click at the OS level. I've had to use that same
>trick before as well, but if someone has a slower (i.e 500ms) double
>click rate, then you run into the same problem of doSomething()
>getting called before doSomethingElse() gets called. I'd hate to bake
>that into the SDK, since there's no "standard" speed at which double
>click is performed. Of course, unless we surface the ability to change
>that rate, which is a valid option. Unless someone else has a better
>solution???
>
>- Doug
I worked with this a bit.  The maximum TO is usually 500 MS.  Note that
the click event itself is fired when the mouse user releases the button,
not on the down click itself.

Is there a public API in the runtime to grab the double-click delay time
from the users system?

Duane
******************

COO and Director 
Uberity Technology Corporation
"LiveCycle ES and Mobile Specialists"
http://www.uberity.com
@uberity @duanechaos


>



Re: [Proposal] Different behaviour on click and doubleClick on UIComponent

Posted by Doug Arthur <do...@gmail.com>.
On Fri, Apr 20, 2012 at 9:43 AM, andrei apostolache
<ap...@gmail.com> wrote:
> Hi Scott,
>
> Is not about a new component, it's about all spark components that are
> based on UIComponent. Think for example a simple spark button, <s:Button
> click="doSomething()" doubleClick="doSomethingElse()"
> doubleClickEnabled="true" /> if you will try to double click the button
> first it will trigger doSomething() and then doSomethingElse(), while the
> expectation would be: click received (should obfuscate it for 300 ms to see
> if the user is going for a double click), if second click happens trigger
> doSomethingElse(), otherwise trigger doSomething().

The problem you have with a timer, is the speed at wich individuals
set their double click at the OS level. I've had to use that same
trick before as well, but if someone has a slower (i.e 500ms) double
click rate, then you run into the same problem of doSomething()
getting called before doSomethingElse() gets called. I'd hate to bake
that into the SDK, since there's no "standard" speed at which double
click is performed. Of course, unless we surface the ability to change
that rate, which is a valid option. Unless someone else has a better
solution???

- Doug

Re: [Proposal] Different behaviour on click and doubleClick on UIComponent

Posted by Alex Harui <ah...@adobe.com>.


On 4/20/12 8:43 AM, "andrei apostolache" <ap...@gmail.com>
wrote:

> Hi Scott,
> 
> Is not about a new component, it's about all spark components that are
> based on UIComponent. Think for example a simple spark button, <s:Button
> click="doSomething()" doubleClick="doSomethingElse()"
> doubleClickEnabled="true" /> if you will try to double click the button
> first it will trigger doSomething() and then doSomethingElse(), while the
> expectation would be: click received (should obfuscate it for 300 ms to see
> if the user is going for a double click), if second click happens trigger
> doSomethingElse(), otherwise trigger doSomething().
> 
These requests are why we need to find an efficient plug-in model for the
SDK.  Then you can alter this behavior and not mess up someone who does need
the click when it happens.

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: [Proposal] Different behaviour on click and doubleClick on UIComponent

Posted by andrei apostolache <ap...@gmail.com>.
Hi Scott,

Is not about a new component, it's about all spark components that are
based on UIComponent. Think for example a simple spark button, <s:Button
click="doSomething()" doubleClick="doSomethingElse()"
doubleClickEnabled="true" /> if you will try to double click the button
first it will trigger doSomething() and then doSomethingElse(), while the
expectation would be: click received (should obfuscate it for 300 ms to see
if the user is going for a double click), if second click happens trigger
doSomethingElse(), otherwise trigger doSomething().

I hope it makes more sense.
Thanks,
Andrei.

On Fri, Apr 20, 2012 at 3:29 PM, Guthmann, Scott <sguthmann@on3solutions.com
> wrote:

> > in some cases you might need to have different behavior for a
> button/custom component based on UIComponent for click and double click.
> > An workaround will be to start a 300-400 millisecond timer in your click
> handler to delay your actions (in case the user will go for a
> double-click), but I think the elegant way will be that the UIComponent
> should take care of this once you set on true
> > doubleClickEnabled.
>
> Andrei - the project could use extra custom [Spark] components. Do you
> have a code for this new component you can show us on your white board?
> Please post what you have written and then ask this list to review what you
> have done and provide feedback. If you have use cases for this component
> and the functionality cannot be done with other existing custom components,
> then the Apache Flex project would benefit from having this additional
> option.
>
> Thanks for the input!
>
> Regards,
>
> Scott Guthmann
> Direct | 303.885.9485
> E-mail | SGuthmann@On3solutions.com
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> . . . . . . . . . . . . . . . . . .
> This electronic message transmission contains information from the Company
> that may be proprietary, confidential and/or privileged. The information is
> intended only for the use of the individual(s) or entity named above. If
> you are not the intended recipient, be aware that any disclosure, copying
> or distribution or use of the contents of this information is prohibited.
> If you have received this electronic transmission in error, please notify
> the sender immediately by replying to the address listed in the "From:"
> field.
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> . . . . . . . . . . . . . . . . . .
>
> -----Original Message-----
> From: andrei apostolache [mailto:apostolache.andrei@gmail.com]
> Sent: Friday, April 20, 2012 4:45 AM
> To: flex-dev@incubator.apache.org
> Subject: [Proposal] Different behaviour on click and doubleClick on
> UIComponent
>
> Hi.
>
> It might be a weird proposal, but in some cases you might need to have
> different behavior for a button/custom component based on UIComponent for
> click and double click.
> An workaround will be to start a 300-400 millisecond timer in your click
> handler to delay your actions (in case the user will go for a
> double-click), but I think the elegant way will be that the UIComponent
> should take care of this once you set on true doubleClickEnabled.
>
> Regards,
> Andrei.
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.1913 / Virus Database: 2411/4947 - Release Date: 04/19/12
>

RE: [Proposal] Different behaviour on click and doubleClick on UIComponent

Posted by "Guthmann, Scott" <sg...@on3solutions.com>.
> in some cases you might need to have different behavior for a button/custom component based on UIComponent for click and double click.
> An workaround will be to start a 300-400 millisecond timer in your click handler to delay your actions (in case the user will go for a double-click), but I think the elegant way will be that the UIComponent should take care of this once you set on true
> doubleClickEnabled.

Andrei - the project could use extra custom [Spark] components. Do you have a code for this new component you can show us on your white board? Please post what you have written and then ask this list to review what you have done and provide feedback. If you have use cases for this component and the functionality cannot be done with other existing custom components, then the Apache Flex project would benefit from having this additional option.

Thanks for the input! 

Regards,

Scott Guthmann
Direct | 303.885.9485
E-mail | SGuthmann@On3solutions.com 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
This electronic message transmission contains information from the Company that may be proprietary, confidential and/or privileged. The information is intended only for the use of the individual(s) or entity named above. If you are not the intended recipient, be aware that any disclosure, copying or distribution or use of the contents of this information is prohibited. If you have received this electronic transmission in error, please notify the sender immediately by replying to the address listed in the "From:" field.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

-----Original Message-----
From: andrei apostolache [mailto:apostolache.andrei@gmail.com] 
Sent: Friday, April 20, 2012 4:45 AM
To: flex-dev@incubator.apache.org
Subject: [Proposal] Different behaviour on click and doubleClick on UIComponent

Hi.

It might be a weird proposal, but in some cases you might need to have different behavior for a button/custom component based on UIComponent for click and double click.
An workaround will be to start a 300-400 millisecond timer in your click handler to delay your actions (in case the user will go for a double-click), but I think the elegant way will be that the UIComponent should take care of this once you set on true doubleClickEnabled.

Regards,
Andrei.

-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.1913 / Virus Database: 2411/4947 - Release Date: 04/19/12