User Interface / Widgets / Buttons / Repeat Buttons
In This Topic
    Repeat Buttons
    In This Topic

    Repeat buttons are represented by the NRepeatButton class, which is derived from NButtonBase. When pressed, the repeat button raises its Click event repeatedly at user specified intervals of time.

     Delay and Interval
    Before starting to raise the Click event repeatedly, the repeat button waits for the amount of time specified by the Delay property to elapse. Then it starts to raise the Click event repeatedly at regular intervals of time, that are specified by the Interval property. Both settings are in milliseconds.
     Events

    Besides the Click event, which is inherited from the NButtonBase class, the repeat button offers 2 more events:

    • StartClicking - occurs when the repeat button is about to start raising continuous click events.
    • EndClicking - occurs when the repeat button has stopped raising continuous click events.

    The following example demonstrates how to create a repeat button and handle its events:

    Repeat Button Events
    Copy Code
    ...
    NRepeatButton repeatButton = new NRepeatButton("Repeat button");
    repeatButton.StartClicking += new Function<NEventArgs>(OnRepeatButtonStartClicking);
    repeatButton.Click += new Function<NEventArgs>(OnButtonClicked);
    repeatButton.EndClicking += new Function<NEventArgs>(OnRepeatButtonEndClicking);
    ...
    void OnButtonClicked(NEventArgs arg1)
    {
        Console.WriteLine("Button clicked");
    }
    void OnRepeatButtonStartClicking(NEventArgs arg1)
    {
        Console.WriteLine("Button start repeated clicking");
    }
    void OnRepeatButtonEndClicking(NEventArgs arg1)
    {
        Console.WriteLine("Button end repeated clicking");
    }