treeview.Edited Event Cant make modal dialog

2 posts, 0 answers
  1. Ji -Won
    Ji -Won avatar
    6 posts
    Member since:
    Sep 2011

    Posted 01 Aug 2012 Link to this post

    Hello..
    I tried MessageBox or InstanceForm.showDialog that couldn work at Edited Event.

    this is Sample Code.
    radTreeView1_Edited(object sender, TreeNodeEditedEventArgs e)
    {
        DialogResult result = MessageBox.Show("will you change?","Change",MessageBoxButtons.OkCancel);
        if(result != DialogResult.Ok)
        {
            e.cancel=true;
        }
    }

    at MessageBox.Show Line make Error Message.
    attatch file is that window  


    So I tried make new thread and give to delay.. but that way 
    also if delay is so short or
    when that action time
    if I minimize or doesn focus.
    that showed me similar Error.
    Plz Give me a Solution.....

    Thanks.
  2. Svett
    Admin
    Svett avatar
    728 posts

    Posted 06 Aug 2012 Link to this post

    Hello,

    Thank you for writing.

    The illustrated behavior occurs because you are causing the tree view control to loose its focus in the Editing event. You can work around it by creating custom tree view in the following manner:
    public class MyTreeView : RadTreeView
    {
        public MyTreeView()
        {
            this.ThemeClassName = typeof(RadTreeView).FullName;
        }
     
        protected override void OnLostFocus(System.EventArgs e)
        {
            
        }
    }

    I hope this helps. Let us know if you have any other questions.

    Regards,
    Svett
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top