theniteowl
Programmer
Hi,
I am trying to imitate scrollbar buttons in Javascript and have run into an issue.
I am using onmousedown to first alter the button displayed to show a pressed image, then triggering an interval that will cause repeated scrolling of the display window in case the arrow button is held down.
I then use onmouseup to cancel the interval and stop the scrolling and toggle the button display to a non-pressed version.
The issue comes from the slow speed at which click events are registered. If someone is clicking rapidly on the button I want to screen to scroll rapidly as well, just as a normal Windows application would respond. The onmouse or onclick events are too slow to keep up with a burst of mouse clicks.
I tried using an ondblclick event to fire off a double set of scroll commands and that works well but then I run into problems with toggling of the up/down state of the button.
Since the ondblclick event inherantly means mousdown/click/mouseup/mousedown/click/mouseup the other events are firing as well and at some point portion of code that brings the button back UP is swamped so that a rapid double click always results in the button remaining in the DOWN position.
Is my approach bad? Is there a way to do this successfully?
I need the speed of double clicks and the repeats of holding down the mouse button. I would like to keep the 3d button action as well but so far cannot find a way to do it.
NOTE: A normal scrollbar will not work simply because I need to detect when the top or bottom of the data has been reached and then if the arrow is clicked again it will trigger an event to grab more data. Since I cannot detect button presses of a DHTML scrollbar I have no event trigger to grab more data when needed.
Using button objects let's me know when a button is clicked and I can check the scroll position of the window and the two pieces of data let me know when to trigger the additional event.
Anyone have a better approach?
I can post my code but I have to clean it up and shorten it to give a good sample.
Thanks.
I am trying to imitate scrollbar buttons in Javascript and have run into an issue.
I am using onmousedown to first alter the button displayed to show a pressed image, then triggering an interval that will cause repeated scrolling of the display window in case the arrow button is held down.
I then use onmouseup to cancel the interval and stop the scrolling and toggle the button display to a non-pressed version.
The issue comes from the slow speed at which click events are registered. If someone is clicking rapidly on the button I want to screen to scroll rapidly as well, just as a normal Windows application would respond. The onmouse or onclick events are too slow to keep up with a burst of mouse clicks.
I tried using an ondblclick event to fire off a double set of scroll commands and that works well but then I run into problems with toggling of the up/down state of the button.
Since the ondblclick event inherantly means mousdown/click/mouseup/mousedown/click/mouseup the other events are firing as well and at some point portion of code that brings the button back UP is swamped so that a rapid double click always results in the button remaining in the DOWN position.
Is my approach bad? Is there a way to do this successfully?
I need the speed of double clicks and the repeats of holding down the mouse button. I would like to keep the 3d button action as well but so far cannot find a way to do it.
NOTE: A normal scrollbar will not work simply because I need to detect when the top or bottom of the data has been reached and then if the arrow is clicked again it will trigger an event to grab more data. Since I cannot detect button presses of a DHTML scrollbar I have no event trigger to grab more data when needed.
Using button objects let's me know when a button is clicked and I can check the scroll position of the window and the two pieces of data let me know when to trigger the additional event.
Anyone have a better approach?
I can post my code but I have to clean it up and shorten it to give a good sample.
Thanks.