Pelles C forum

C language => User contributions => Topic started by: CFred on August 05, 2025, 03:46:25 PM

Title: Treeview control with drag and drop functionality
Post by: CFred on August 05, 2025, 03:46:25 PM
The attached zip file shows how to implement a treeview control with drag and drop functionality. I could not find anything similar in 'C' on the web and as this took some time to develop and debug I am posting the code as it may be useful for other members of this forum.

The code is well documented to make it easy to follow. Some functions are rather long and could be simplified by breaking them down into smaller functions if required.

Update

I have updated the tree control so that the drag and drop functionality has been placed in a module.
I have also fixed a bug that caused the program to crash when a branch was dragged onto itself.


Title: Re: Treeview control with drag and drop functionality
Post by: Akko on August 07, 2025, 07:45:18 AM
Well done !!! 
Title: Re: Treeview control with drag and drop functionality
Post by: MrBcx on August 07, 2025, 03:04:43 PM
Nice job! 

I've never been a big fan of the treeview control but you've added functionality to it that might change that.

Now permanently stored in my burgeoning toolkit of code.   ;D

Thank you for sharing.
Title: Re: Treeview control with drag and drop functionality
Post by: John Z on August 08, 2025, 10:18:54 PM
Thanks CFred!  Great work, and excellent comments too.

All I can say is 👍👍👍, it will be in my meager toolbox too.
Even if unused a good example to learn from.

John Z
Title: Re: Treeview control with drag and drop functionality
Post by: TimoVJL on August 10, 2025, 12:13:31 PM
Thanks !
Nice example for learning purboses.
Title: Re: Treeview control with drag and drop functionality
Post by: Vortex on August 10, 2025, 08:36:25 PM
Hi Fred,

Great job, thanks for sharing.