c# - Randomly disappearing Multi_select TreeView -


recently downloaded multi_select treeview here. add option select multiple treenodes.

i use 3 tabcontrols 1 multi_select treeview on each page (created dynamicly). there's option drag first 1 , drop on another. can add additional tabpage(with treeviwe on it) on each of tabcontrols.

problem treeview (drag source) randomly disappearing, caused different actions. it's caused fast drag , drop 1 tabcontrol another. disappears after creating new tabpage. happens every 20-30 times. it's hard debug drag , drop actions, when it's not happening every time.

here's event handlers provide drag , drop.

private void tv_itemdragsource(object sender, itemdrageventargs e)     {         if (((multiselecttreeview.multiselecttreeview)sender).selectednodes.count == 0 || (((multiselecttreeview.multiselecttreeview)sender).selectednodes.count == 1 && ((multiselecttreeview.multiselecttreeview)sender).selectednodes[0] != ((treenode)e.item)))         {             ((multiselecttreeview.multiselecttreeview)sender).selectednodes.clear();             ((multiselecttreeview.multiselecttreeview)sender).selectednodes.add((treenode)e.item);         }          foreach (treenode in ((multiselecttreeview.multiselecttreeview)sender).selectednodes)         {             if (i.level != 0)                   return;         }          dodragdrop(((multiselecttreeview.multiselecttreeview)sender).selectednodes, dragdropeffects.copy);          ((multiselecttreeview.multiselecttreeview)sender).endupdate();     }  private void tv_dragentersource(object sender, drageventargs e)     {         e.effect = dragdropeffects.copy;     }  private void tv_dragdropsource(object sender, drageventargs e)     {         treenode rewritten = new treenode();         arraylist selectnodes = e.data.getdata(e.data.getformats()[0]) arraylist;          foreach (treenode in selectnodes)         {             rewritten.text = i.text;             ((treeview)sender).nodes.add(rewritten);             foreach (treenode j in i.nodes)             {                 rewritten.nodes.add(j.text);             }             rewritten = new treenode();         }          foreach (treenode in ((multiselecttreeview.multiselecttreeview)sender).nodes)         {             i.backcolor = color.white;             i.forecolor = systemcolors.windowtext;         }          selectnodes.clear();      }  void tv_lostfocus(object sender, eventargs e)     {         foreach (treenode in ((multiselecttreeview.multiselecttreeview)sender).nodes)         {             i.backcolor = color.white;             i.forecolor = systemcolors.windowtext;         }         ((multiselecttreeview.multiselecttreeview)sender).selectednodes.clear();     }  void tv_mouseup(object sender, mouseeventargs e)     {         ((multiselecttreeview.multiselecttreeview)sender).endupdate();     }   void tv_mousedown(object sender, mouseeventargs e)     {         ((multiselecttreeview.multiselecttreeview)sender).beginupdate();     } 

i've added changing of treenodes colour, because there problems selecting different nodes after earlier drag , drop.

thanks in advance! sorry poor english.

i managed solve problem. suspected problem in beginupdate no endupdate triggered. i've added:

((multiselecttreeview.multiselecttreeview)sender).endupdate(); 

on mouseleave. works now.

have nice day. :)


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -