Re: Onclick and ondblclick on same element

2007-10-01 Thread Federico Fanton
On Mon, 1 Oct 2007 02:10:13 -0700 (PDT)
swaroop belur <[EMAIL PROTECTED]> wrote:

> b1.setThrottleDelay(Duration.valueOf(1000)); // Make sure dbl click happens 
> before onclick

So the delay takes place *before* the first event, not after? I see.. Many 
thanks! :)


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Onclick and ondblclick on same element

2007-10-01 Thread swaroop belur

Hi

Try this out . This may surely not be the best way to do it.
Here when u dbl click, the single click event still occurs...but i am using
a variable to detect whether dbl click event happened before or not.
In that case, i simply return after toggling back.


Click Test 


WebMarkupContainer click = new WebMarkupContainer("click");
click.setOutputMarkupId(true);
AjaxEventBehavior b1 = new AjaxEventBehavior("onclick"){

@Override
protected void onEvent(AjaxRequestTarget target) {
if(dblclickevent){
dblclickevent = false;
return;
}
target.appendJavascript("alert('onclick 
occurred');");
dblclickevent = false;
}

};

b1.setThrottleDelay(Duration.valueOf(1000)); // Make sure
dbl click happens before onclick

click.add(b1);

AjaxEventBehavior b2 = new AjaxEventBehavior("ondblclick"){

@Override
protected void onEvent(AjaxRequestTarget target) {
target.appendJavascript("alert('ondblclick 
occurred');");
dblclickevent = true;
}


};
click.add(b2);
add(click);


-swaroop


Federico Fanton wrote:
> 
> On Fri, 28 Sep 2007 16:43:05 +0200
> Federico Fanton <[EMAIL PROTECTED]> wrote:
> 
>> My problem is that when I double click on the row three events are fired:
>> two onclick and one ondblclick.. Is this normal? Is there a way to
>> isolate the last event and ignore the first two?
> 
> I googled some more, and found that usually the workaround is to set a
> timeout for the onclick function, so that if ondblclick gets fired before
> the timeout, it cancels the onclick and goes on about its business.. Is
> there a Wicket behavior that works this way, perhaps? ^__^; I could extend
> AbstractAjaxTimerBehavior maybe..
> 
> Many thanks for your time!
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Onclick-and-ondblclick-on-same-element-tf4534962.html#a12975648
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Onclick and ondblclick on same element

2007-10-01 Thread Federico Fanton
On Fri, 28 Sep 2007 16:43:05 +0200
Federico Fanton <[EMAIL PROTECTED]> wrote:

> My problem is that when I double click on the row three events are fired: two 
> onclick and one ondblclick.. Is this normal? Is there a way to isolate the 
> last event and ignore the first two?

I googled some more, and found that usually the workaround is to set a timeout 
for the onclick function, so that if ondblclick gets fired before the timeout, 
it cancels the onclick and goes on about its business.. Is there a Wicket 
behavior that works this way, perhaps? ^__^; I could extend 
AbstractAjaxTimerBehavior maybe..

Many thanks for your time!


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Onclick and ondblclick on same element

2007-09-28 Thread Federico Fanton
Hi everyone!
I fear this isn't strictly Wicket-related, but I'm having a little problem with 
a table row having two associated events: onclick and ondblclick.
Onclick should highlight the row, while Ondblclick should jump to another page 
passing along information about the selected row..
My problem is that when I double click on the row three events are fired: two 
onclick and one ondblclick.. Is this normal? Is there a way to isolate the last 
event and ignore the first two? (I'm using Firefox 2 btw)

Many thanks for your attention!


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]