News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Recent posts

#31
User contributions / Re: Treeview control with drag...
Last post by TimoVJL - August 10, 2025, 12:13:31 PM
Thanks !
Nice example for learning purboses.
#32
User contributions / Re: Treeview control with drag...
Last post by John Z - 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
#33
User contributions / Re: Treeview control with drag...
Last post by MrBcx - 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.
#34
User contributions / Re: Treeview control with drag...
Last post by Akko - August 07, 2025, 07:45:18 AM
Well done !!! 
#35
Beginner questions / Re: Trreview problem with movi...
Last post by CFred - August 05, 2025, 03:48:01 PM
I have implemented a treeview control with full drop and drag functionality at https://forum.pellesc.de/index.php?topic=11646.0
#36
User contributions / Treeview control with drag and...
Last post by CFred - 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.


#37
Beginner questions / Re: Trreview problem with movi...
Last post by CFred - July 28, 2025, 05:47:58 PM
I have updated the demonstration code in previous posts to tidy it up. I have also included the use of two different icons for parent and child nodes and a "No entry" cursor when dragging a node to itself.

The icons taken from The Silk icon pack (was available on the famfamfam website - no longer functioning), whose author is Mark James.

The code needs more work so that subtrees can be moved. I will post a version for moving subtrees once I have developed it fully. At the moment this is work in progress.



#38
User contributions / Mike Henning's Link2Res
Last post by Vortex - July 26, 2025, 10:52:43 AM
MrBcx, the Administrator of the BCX Forum explains how to build this useful resource linker :

QuoteMike Henning wrote this app in 2006 and it still builds today using the current version of BCX.

It is important that you build this as a 32-bit executable, to minimize warnings and to ensure
its proper operation.  Be certain to build it as a console mode app.

This app can attach a proper Windows binary resource file (*.res) to any 32-bit or 64-bit exe.
This is particularly good news for for folks that prefer working with the MINGW toolchain, as
WINDRES is not particularly adept at dealing with *.res files.

https://bcxbasiccoders.com/smf/index.php?topic=1382.0
#39
Beginner questions / Re: Trreview problem with movi...
Last post by John Z - July 26, 2025, 01:52:10 AM
Thanks CFred!

Very nice.  Grabbed it for learning and future reference. 
I've used TreeView quite a bit, but never needed to drag and drop a leaf,

John Z
#40
Beginner questions / Re: Trreview problem with movi...
Last post by CFred - July 25, 2025, 05:30:31 PM
At last I managed to find a bug in my code at line 560 in the previously uploaded version of the code in the function TREE_MoveSingleBranch().

I changed the line:

tvItem.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_STATE | TVIF_CHILDREN;
to:

tvItem.mask = TVIF_HANDLE | TVIF_TEXT;
I am uploading the working version in case anybody finds it useful (there is very little information on the internet that I could find for dragging tree nodes, particularly as Code Project is no longer available). The code is heavily commented to explain how the it works. I have not tidied up the code so I leave this for anybody who wants to use it.