Slider control and mouse up event

  1. 2 months ago

    Robert W

    Sep 13 Western Canada

    I have a slider that I use for color selection, and have the live scroll property set to true so that as I move the slider, the color of a small rectangle changes color. That works fine. However, when I release the slider, I'd like a complex image to update in a canvas. That process takes a second or two, so it's not practical to include that in the value changed event of the slider. I thought that maybe I could use the mouse up event in the slider to trigger the canvas redraw, but it appears that mouse button events are not compatible with the slider. The language reference says that in order to use the mouse up event, then the mouse down event must be set to return true. If I add the mouse down event and have it return true, then the slider control won't do anything when I try to move it. It's frozen.

    Is there some other way to achieve what I'm trying to do here?

    Add a timer with a trigger time of maybe 0.5 second or less. Initially disabled.

    In the live resizing events, enable and set the timer mode to 1
    Each change will reset the timer in this way without allowing it to fire immediately.

    If no change occurs in 0.5 second because the slider has stopped moving - the timer will fire.
    In the timer event, disable the timer and do your complicated drawing.

  2. usually it's a split second
    it's up to you to redraw yourself

  3. Robert W

    Sep 13 Western Canada
    Edited 2 months ago

    Yes, I realize that, but I need to have the slider generate a signal that tells me when it's time to redraw the canvas. With the live scroll active, it will generate value changed events many times per second which will bog down the program. If I turn off the live resize, then the color display won't update as I move the slider. What I need is an additional single event when the user lets go of the slider, to redraw the canvas.

  4. 9 weeks ago

    Jeff T

    Sep 13 Answer Midlands of England, Europe

    Add a timer with a trigger time of maybe 0.5 second or less. Initially disabled.

    In the live resizing events, enable and set the timer mode to 1
    Each change will reset the timer in this way without allowing it to fire immediately.

    If no change occurs in 0.5 second because the slider has stopped moving - the timer will fire.
    In the timer event, disable the timer and do your complicated drawing.

  5. Robert W

    Sep 13 Western Canada

    Thanks. I kinda figured that a timer might be needed. I also included a system.mousedown test in the timer action handler just in case the user stops moving the slider but doesn't release the mouse button right away.

or Sign Up to reply!