Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Editors (TextBox, MaskedEdit, SpinEditor, BrowseEditor, ColorBox) > Erorr SpinEditor: when ValueChanged have MessageBox

Answered Erorr SpinEditor: when ValueChanged have MessageBox

Feed from this thread
  • remeo avatar

    Posted on Sep 7, 2011 (permalink)

    Hello Admin!

    I have a SpinEditor value = 3. I use ValueChanged event so do it. When value of that control to 2, I call MessageBox. But button Down of that control set yellow color (spineditor.jpg).
    I want that control not set yellow color & reset that control.

    Help me!
    Thank you!

    My code :

    private void spChangedGridView_ValueChanged(object sender, EventArgs e)
    {
            if (int.Parse(spChangedGridView.Value.ToString()) < 3)
             {
                    spChangedGridView.SpinElement.Value = 3;
                    MessageBox.Show("NO");
             }
    }
    Attached files

    Reply

  • Peter Peter admin's avatar

    Posted on Sep 8, 2011 (permalink)

    Hello Remeo,

    This is a feature of our themes. In your case RadSpinEditor buttons stay in pressed state because the modal dialog intercepts all events. You can work around the issue by handling the ValueChanged event. Here is a sample:

    private void spChangedGridView_ValueChanged(object sender, EventArgs e)
    {
        if (int.Parse(spChangedGridView.Value.ToString()) < 3)
        {
            spChangedGridView.SpinElement.UpButton.SetValue(RadElement.IsMouseDownProperty, false);
            spChangedGridView.SpinElement.DownButton.SetValue(RadElement.IsMouseDownProperty, false);
            spChangedGridView.SpinElement.Value = 3;
            MessageBox.Show(this.spChangedGridView, "NO");
        }
    }

    I hope this helps. If you have any further questions, do not hesitate to contact me. Best wishes,
    Peter
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

    Reply

  • remeo avatar

    Posted on Sep 8, 2011 (permalink)

    Thank you Admin!

    But that it value return not true.
    Example : you down value < 3, it call MessageBox. After you up value to 7, you down use mouse 1 click --> it value will return to 3. If it true , it will return to 6.

    Thanks!

    Reply

  • Answer Peter Peter admin's avatar

    Posted on Sep 14, 2011 (permalink)

    Hello Remeo,

    I can confirm the described behavior and it is a normal behavior. This is because you modified the Value in ValueChanged event. By design, RadSpinEditor handles a similar restriction with Minimum and Maximum properties. I would like to propose a new approach to cover your scenario:
    1. Handle Leave event and set Value to 3
    2. Handle DownButton MouseUP event and set Value to 3
    Consider the attached sample project.
    I hope this helps.

    All the best,
    Peter
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

    Reply

  • remeo avatar

    Posted on Sep 16, 2011 (permalink)

    Thank you Peter!
    It's work.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Editors (TextBox, MaskedEdit, SpinEditor, BrowseEditor, ColorBox) > Erorr SpinEditor: when ValueChanged have MessageBox
Related resources for "Erorr SpinEditor: when ValueChanged have MessageBox"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]