{"action":"created","issue":{"url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/issues/364","labels_url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/issues/364/labels{/name}","comments_url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/issues/364/comments","events_url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/issues/364/events","html_url":"https://github.com/Virtual-TreeView/Virtual-TreeView/issues/364","id":54833004,"number":364,"title":"CopyTo fails when target has uninitialized child nodes","user":{"login":"vincentparrett","id":1037262,"avatar_url":"https://avatars.githubusercontent.com/u/1037262?v=3","gravatar_id":"","url":"https://api.github.com/users/vincentparrett","html_url":"https://github.com/vincentparrett","followers_url":"https://api.github.com/users/vincentparrett/followers","following_url":"https://api.github.com/users/vincentparrett/following{/other_user}","gists_url":"https://api.github.com/users/vincentparrett/gists{/gist_id}","starred_url":"https://api.github.com/users/vincentparrett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincentparrett/subscriptions","organizations_url":"https://api.github.com/users/vincentparrett/orgs","repos_url":"https://api.github.com/users/vincentparrett/repos","events_url":"https://api.github.com/users/vincentparrett/events{/privacy}","received_events_url":"https://api.github.com/users/vincentparrett/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/labels/imported","name":"imported","color":"FFFFFF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-20T01:28:56Z","updated_at":"2015-01-20T01:28:56Z","closed_at":null,"body":"_From [nos...@efilive.com](https://code.google.com/u/112432473582323317592/) on August 31, 2013 17:46:23_\n\nWhat steps will reproduce the problem? 1. Run attached sample project.\r\n2. Click [Populate Tree] to set up the nodes.\r\n3. Expand the first node \"Colors\"\r\n4. Drag the child node \"Red\" and drop it on the \"Shapes\" node (without hovering long enough for the node to auto expand).\r\n5. Expand the \"Shapes\" node. What is the expected output? What do you see instead? Expected output after the drag drop described above is: the \"Shapes\" node should contain the following four child nodes: Red, Circle, Square, Triangle.\r\n\r\nInstead the \"Shapes\" node only contains the single node that was dragged: \"Red\". What version of the product are you using? On what operating system? V5.1.3\r\nWin7 Please provide any additional information below. The problem occurs because the InternalConnectNode function when using attachmodes: amAddChildFirst or amAddChildLast naively adds the \"Red\" node without regard to the as yet uninitialized children: Circle, Square, Triangle. That causes those three nodes to never be included.\r\n\r\nTo fix the problem, I added this code to the start of both case items amAddChildFirst and amAddChildLast:\r\n\r\n      amAddChildFirst:\r\n        begin\r\n          // Start patch by Blacky: Sep 01, 2013\r\n          if (vsHasChildren in Destination.States) and (Destination.ChildCount = 0) then\r\n            ReinitNode(Destination,true);\r\n          // End patch by Blacky: Sep 01, 2013\r\n\r\n...\r\n\r\n      amAddChildLast:\r\n        begin\r\n          // Start patch by Blacky: Sep 01, 2013\r\n          if (vsHasChildren in Destination.States) and (Destination.ChildCount = 0) then\r\n            ReinitNode(Destination,true);\r\n          // End patch by Blacky: Sep 01, 2013\r\n\r\nIt's a sledge-hammer approach, since only the immediate children of the destination node need to be initialized (not all children recursively), but I couldn't find a tree function that just initializes the immediate children.\n\n**Attachment:** [vstBug_002.zip](http://code.google.com/p/virtual-treeview/issues/detail?id=363)\n\n_Original issue: http://code.google.com/p/virtual-treeview/issues/detail?id=363_"},"comment":{"url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/issues/comments/70590266","html_url":"https://github.com/Virtual-TreeView/Virtual-TreeView/issues/364#issuecomment-70590266","issue_url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/issues/364","id":70590266,"user":{"login":"vincentparrett","id":1037262,"avatar_url":"https://avatars.githubusercontent.com/u/1037262?v=3","gravatar_id":"","url":"https://api.github.com/users/vincentparrett","html_url":"https://github.com/vincentparrett","followers_url":"https://api.github.com/users/vincentparrett/followers","following_url":"https://api.github.com/users/vincentparrett/following{/other_user}","gists_url":"https://api.github.com/users/vincentparrett/gists{/gist_id}","starred_url":"https://api.github.com/users/vincentparrett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincentparrett/subscriptions","organizations_url":"https://api.github.com/users/vincentparrett/orgs","repos_url":"https://api.github.com/users/vincentparrett/repos","events_url":"https://api.github.com/users/vincentparrett/events{/privacy}","received_events_url":"https://api.github.com/users/vincentparrett/received_events","type":"User","site_admin":false},"created_at":"2015-01-20T01:28:56Z","updated_at":"2015-01-20T01:28:56Z","body":"_From [joachim....@gmail.com](https://code.google.com/u/109917800154443778416/) on September 02, 2013 12:13:55_\n\nDoes the problem also occur with V5.2.0?\r\nDoes anyone have an idea for a less invasive fix?"}}