Forums > Javascript

onclick / ondrag events

July 23, 2006 | 8:16 pm

I am using the onclick and ondrag event handlers in my jsui, and found out
that:

- the onclick event is called on both the down and up state of the button,
so twice on every click.
- the ondrag event is called on every click, even though there is absolutely
no dragging.

Now I need to manually filter out duplicate clicks, because of the
processing that gets called by these events. It seems like a real waste. Is
this really the way it’s supposed to work?

-thijs


July 24, 2006 | 5:33 pm

On Jul 23, 2006, at 1:16 PM, Thijs Koerselman wrote:

> I am using the onclick and ondrag event handlers in my jsui, and
> found out that:
>
> – the onclick event is called on both the down and up state of the
> button, so twice on every click.

I would suggest you look at the button flag to determine if it is a
mouse down or a mouse up.

> – the ondrag event is called on every click, even though there is
> absolutely no dragging.

I would suggest you look at the mouse position if you only want to
handle actual movement.

-Joshua


July 24, 2006 | 5:47 pm

Aha, I didn’t realize the button flag was there. I don’t think it is
mentioned anywhere in the docs, except in the function arguments. Thanks. I
think in my case can use ondrag for all event handling, if it also include
clicks.

best,
-thijs

On 7/24/06, Joshua Kit Clayton wrote:
>
>
> On Jul 23, 2006, at 1:16 PM, Thijs Koerselman wrote:
>
> > I am using the onclick and ondrag event handlers in my jsui, and
> > found out that:
> >
> > – the onclick event is called on both the down and up state of the
> > button, so twice on every click.
>
> I would suggest you look at the button flag to determine if it is a
> mouse down or a mouse up.
>
> > – the ondrag event is called on every click, even though there is
> > absolutely no dragging.
>
> I would suggest you look at the mouse position if you only want to
> handle actual movement.
>
> -Joshua
>
>


July 24, 2006 | 5:59 pm

On Jul 24, 2006, at 10:47 AM, Thijs Koerselman wrote:

> Aha, I didn’t realize the button flag was there. I don’t think it
> is mentioned anywhere in the docs, except in the function
> arguments. Thanks. I think in my case can use ondrag for all event
> handling, if it also include clicks.

Definitely recommend checking out the example JSUI files which show
this usage.

-Joshua


Viewing 4 posts - 1 through 4 (of 4 total)