onclick / ondrag events

Thijs Koerselman's icon

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

Joshua Kit Clayton's icon

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

Thijs Koerselman's icon

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
>
>

Joshua Kit Clayton's icon

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