locked
Press-&-hold a button to incrament a value RRS feed

  • Question

  • Greetings All,

     

    Hopefully an simple question ...

     

    Using a standard 'button' control, and a 'Click' event I can increment a variable (in C#) each time I click the button.  Q: How would I go about using the button so when I press-&-hold it the value will increment 'automatically' e.g. Like holding down the volume control on a remote, you don't have to press it 50 times, just hold it down and it rapidly increments.

     

    Many Thanks in Advance,

    Regards,

    -RJ-

     

    (...Using Blend3, WPF)

     

     

    Thursday, May 20, 2010 3:46 PM

Answers

  • Look into using the RepeatButton provided by WPF. 

    Though I don't know if its available in sketchflow per-se. That process might have to be animated. HTH


    William Wegerson (www.OmegaCoder.Com)
    • Marked as answer by dt01rrj Friday, May 21, 2010 9:50 AM
    Thursday, May 20, 2010 4:47 PM
  • If you can't use repeatbutton for some reason, you could simulate that by starting a recurring timer on the click event which increments your count, and stop the timer when you get the MouseLeftButtonUp event, or something similar to that.
    • Marked as answer by dt01rrj Friday, May 21, 2010 9:50 AM
    Thursday, May 20, 2010 5:30 PM
    Moderator

All replies

  • Look into using the RepeatButton provided by WPF. 

    Though I don't know if its available in sketchflow per-se. That process might have to be animated. HTH


    William Wegerson (www.OmegaCoder.Com)
    • Marked as answer by dt01rrj Friday, May 21, 2010 9:50 AM
    Thursday, May 20, 2010 4:47 PM
  • If you can't use repeatbutton for some reason, you could simulate that by starting a recurring timer on the click event which increments your count, and stop the timer when you get the MouseLeftButtonUp event, or something similar to that.
    • Marked as answer by dt01rrj Friday, May 21, 2010 9:50 AM
    Thursday, May 20, 2010 5:30 PM
    Moderator
  • Many thanks to you both for you suggestions,

     

    I didn't realise there was a 'RepeatButton' control hidden in there - it's a shame its not simply an option in the standard 'button' control i.e. repeat on/off.

     

    Many Thanks,

    -RJ-

     

     

    Friday, May 21, 2010 10:06 AM