Topic: treeview moving parent
Hi,
is there some example when i move parent in treeview that child move with parent
My Visual Database → General → treeview moving parent
Hi,
is there some example when i move parent in treeview that child move with parent
move nodes at the same level
https://myvisualdatabase.com/forum/view … 545#p32545
Hi all
This version of the program has two examples in one.
Dmitry's example and my example.
My example allows you to move a node with or without child nodes to any new location in the tree. Does not use any additional table columns. Control using the mouse pop-up menu.
Something like this.
Hi Sparrow,
I've always thought that being unable to move rows (and their children) from one node to another was a big weakness but this code has improved the functionality of 'treeview' considerably.
Thanks for sharing,
Derek.
Hi Derek.
There is nothing complicated about moving a node. Just change the ParentID of one record and that record, and if there are child records, will change its binding. At first I tried to do it for a long time using mouse dragging. The solution was not simple and not universal. I did not show it. Now I changed the approach and did it through the pop-up menu. I'm glad if it is useful.
Hi Igor, Sparrow,
Attached is an example of a ''treeview'' with functionality to move nodes (including children) by drag and drop (click and hold down the mouse on the node you want to move, drag it to its new position and then release the mouse).
I think Jean and Adam use ''treeviews'' quite a lot so maybe they (and others) will find this useful.
Derek.
Hello Sparrow, Hello Derek
Both methods for moving nodes in a TreeView are equal.
I tested Sparrow's: it works well but the manipulation seems more complex (I'll try to modify it to work only with shortcuts). To be tested!
Derek's is much simpler, it's the classic Drag'Drop as I like it. In addition, I find it faster
Thanks to both of you for these two approaches
JB
Hi Derek, Jean
I want to warn you that my example and Derek's example have a critical error.
When specifying a target for moved nodes in the child record below, the moved nodes disappear. ParentID refers to nodes within itself.
I will fix it in my example soon.
Hi Sparrow, Jean,
I had the same problem but thought that I'd fixed it in the script (Line24 - "if (form1.edit3.value <> form1.edit1.value)" to stop the ParentID being set to the ID and the node disappearing).
Any chance you can give me a 'step by step' example of the problem you've found as I can't re-create it and then I can try to correct it.
Thanks for your help,
Derek.
(Line24 - "if (form1.edit3.value <> form1.edit1.value)" to stop the ParentID being set to the ID and the node disappearing).
Derek.
The problem occurs when a node with child records is moved and one of the child records is selected as the target for moving.
Let's say the fifth row is moved along with its child rows, the sixth and seventh.
If you specify the sixth or seventh as the insertion location, the problem will occur.
Hi Sparrow,
Yes, I see the problem now.
I'll have a look later on and see if it can be fixed.
Thanks,
Derek.
Corrected and supplemented version of the example.
Removed unnecessary code and elements.
Fixed errors, added new ones.
Hi Sparrow,
Yes, I see the problem now.
I'll have a look later on and see if it can be fixed.
Thanks,
Derek.
Derek look at one more thing. If the tree is larger than the height of the TreeView component.
Hi all,
With Derek's permission, here are two versions of the example of dragging tree nodes with the mouse in one archive.
Derek's corrected version and my version. Both versions do the same job. Hopefully without any major errors this time.
Hey Sparrow,
No permission needed - it's good when we can all exchange ideas on the Forum and make suggestions to each others' projects. Everyone wins.
I really like the ''scrolltree'' procedure that you've added - I was looking at the problem but didn't manage to find a fix.
Thanks for your interest and input.
Derek.
Hi Guys,
Thank you very much for tree nodes drag n drop....
Santa arrived to MVD bit late but still truly appreciated the Gift.....
Hi all,
With Derek's permission, here are two versions of the example of dragging tree nodes with the mouse in one archive.
Derek's corrected version and my version. Both versions do the same job.Hopefully without any major errors this time.
Hi Sparrow,
If I'm not doing something wrong, cannot move node up and down on same level. Moved node goes as a child.
HI Adam
Perhaps you are talking about moving WITHIN ITS NODE (changing the location)? Yes, that is not the case.
Our solutions with Derek for moving between nodes and changing the binding in the database.
For changing the PLACE WITHIN ITS NODE I gave the link above.
If we are talking about different things, can we take a look at your example?
HI Adam
....For changing the PLACE WITHIN ITS NODE I gave the link above.
...
Thanks... It would have been great if it could be done both. However, what you guys have done truly appreciated...
I got the script you refer. I originally asked to Dmitry for the script - moving nodes on same level.
I get it work sometimes OK sometimes not.
For instance, the attached sample project I couldn't get it working. I checked syntax etc., but couldn't find the cause of failure.
The database table did not contain any values in the record_count column.
Thank you very much........
I tried to browse db using SQL Lite Studio but couldn't locate the value you have added in the record_count column. I'm fairly ignorant on using SQL Lite Studio.
I guess Issue is caused by old project I was trying to use.
I added values 1...4
Hi Sparrow,
Thank you very much for the info.
My Visual Database → General → treeview moving parent
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi