Thursday, July 10, 2008

The Double-Click Event 



At work, we are working on a list of items that we want to rearrange. We have added Up and Down arrows next to the list, and upon clicking on up or down, our code moves the selected item up or down. Often, we had a user add an item to this list, which brings it to the bottom. They intended it to be on the top, so they click on the up arrow rapidly to bring the item to the top of the list.

The effect is a sort staggered move - the clicking isn't responsive for every click. Only by clicking slowly, do we see the correct behavior.

Today, Mike realized the problem - we were responding to the "Click Event" and it was behaving properly, but we were not responding the the "Double-Click Event" If you click twice quickly, the Click Event registers for the first one, and the Double-Click Event registers for the following one. The result - one click we respond to, and one click that has no code to react to it. Mike coded in the "Double-Click Event" to mirror the effect of teh "Click Event" and voila! A responsive up and down arrow images that move up and down the list quickly.

Labels:


Comments: Post a Comment

This page is powered by Blogger. Isn't yours?