473,721 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

custom sorting a tree view (making folders show on top)

How would you go about doing this

I have a tree view which where anything is a parent it is a folder (folder
icon, and the tag for the object is a string that says "FOLDER:{na me of
folder here}") then each folder has items in it and possibly more folders.
The root node also has items on it that are not folders... but default
sorting sorts by name, so folders do not show up on top. pretty much
anything that has children are to show on top (because they are a folder).
How would I get a tree view to sort like this? Thanks!
Nov 21 '05 #1
3 2165
I don't think there is support for custom sorting out of the box for the
TreeView class. You ill have to resort to Win32 API using PInvoke. Using the
API, you can custom sort a node by specifying a callback function which is
called every two nodes need to be compared. Use the TVM_SORTCHILDRE NCB
Message to sort the children of a particular node.

-Atul, Sky Software http://www.ssware.com
Shell MegaPack For ActiveX & .Net - Windows Explorer Like Shell UI Controls

"Brian Henry" <no****@nospam. com> wrote in message
news:eT******** ******@TK2MSFTN GP15.phx.gbl...
How would you go about doing this

I have a tree view which where anything is a parent it is a folder (folder
icon, and the tag for the object is a string that says "FOLDER:{na me of
folder here}") then each folder has items in it and possibly more folders.
The root node also has items on it that are not folders... but default
sorting sorts by name, so folders do not show up on top. pretty much
anything that has children are to show on top (because they are a folder).
How would I get a tree view to sort like this? Thanks!

Nov 21 '05 #2
If the standard TreeView doesn't offer this support,
take a look at our TList control.
( www.Bennet-Tec.com )
The ItemSortingStyl e property allows you to specify
whether to place all folders belonging to a node above or
below other children when sorting the children.

* * Please include a copy of this message with your reply

-----

Jeff Bennett
Je**@Bennet-Tec.Com

* Bennet-Tec Information Systems, Inc
* 50 Jericho Tpk, Jericho, NY 11753
* Phone 516 997 5596, Fax - 5597
* RELIABLE Components Make You Look Sharp!
* TList/Pro * ALLText HT/Pro * MetaDraw *
* Custom Software Development Services Too.
* WWW.Bennet-Tec.Com

=============== ==== =============== ====

Nov 21 '05 #3
If you are willing to consider a commercial control take a look at
Infralution's Virtual Tree control. It has a sample File Browser
application that does exactly what you want. You can download a fully
functional evaluation version at:

www.infralution.com/virtualtree.html

Regards
Grant Frisken
Infralution

Brian Henry wrote:
How would you go about doing this

I have a tree view which where anything is a parent it is a folder (folder
icon, and the tag for the object is a string that says "FOLDER:{na me of
folder here}") then each folder has items in it and possibly more folders.
The root node also has items on it that are not folders... but default
sorting sorts by name, so folders do not show up on top. pretty much
anything that has children are to show on top (because they are a folder).
How would I get a tree view to sort like this? Thanks!


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
8336
by: megha | last post by:
Hi I want to create a tree type structure for my folders directory in java how i can do it. I know it will be a big programming but how to start please advice.
1
4912
by: Jesper DK | last post by:
Hi, I have docked a tree view to the left on a form. When I start to populate this tree view with nodes, a horizontal scroll box appears in the bottom of the tree view even though thee tree view is big largely big enough to fit the nodes and text. If I widen the tree view the scroll bar doesn't resize itself to show the relative view size in relation to the total size. Only if I narrow the view to not fit the nodes, the scroll box...
3
19453
by: Angapparaj K via .NET 247 | last post by:
Hi, Iam trying to create a custom tree view control in thich i needto display images for some of the nodes. The images need on theright side of the nodes. Is there any way to do this besideshandling the windows notification messages? even if possibleonly thro windows messages, can some one guide me to some csharp code implementing something similar. yours, K.Angapparaj -------------------------------- From: Angapparaj K
3
1590
by: Alan Silver | last post by:
Hello, I am just looking at the tree view control, which looks very good, but has some apparent limitations. This could easily be my lack of experience with it. Specifically, I have two questions... 1) I would like to have more than one root for the tree. Although this may sound odd, it can be logical in certain cases. For example, I have some e-commerce sites where the navigational links are split into two sections, one containing...
1
7344
by: kjon | last post by:
Hi, I'm doing a tree view which will show the file structure in an FTP server. How can I get the standard windows icons for folders and files and display them in the tree view control? Do I need to find the particular image file, the save them in the image list, or can I get the image file in runtime based on the user PC? Please advice. Thanks.
0
1432
by: rinishrk | last post by:
Hi, I have a web application that contains subfolders Admin and User with related webpages inside them. Within the Admin folder I have a page containing a Tree View Control.I want this tree view to have nodes for all pages in the website. However it seems that I cannot create child nodes within this tree view for pages that exist outside the Admin folder.(i.e.pags within the User folder or the Root folder ).It gives me an errors stating...
1
2613
by: happy.john1234 | last post by:
Hi, i have got large xml file which i have to show in tree view windows form.I tried with loading all those data at once to tree view but it took a long time to render that tree view.Now i am looking to polpulate tree view selectively.Only populating those nodes that user expands it by reading xml file.Can any one plz help me with some suggestions or point out to some sample code(it would be better) on how can i accomplish this.Thank in...
1
2967
by: =?Utf-8?B?UHJhZGVlcCBFYXJsYQ==?= | last post by:
Hi I am having one windows application on my local machine and I want to display the folders(shared folders) of remote machine in tree view control of my win application. I haved added me as administartor in that remote machine. The following is my requirement. 1)The Application should show a tree view and a list view. 2) Tree view should show the folder structure and List view should list the
7
4764
by: chaitrabharadwa | last post by:
hi all, I have a treeview and the picturebox in the form. i have a tree view which have icons for each node. i have imagelist which loads icons for nodes in the treeview. some image will be loaded in the picturebox. the user has to drag and drop the icon from the treeview on to the image in the picturebox. when the form is closed, the icons that are dragged and dropped on to the image sud be save.the co-ordinates of the icons on the image sud...
0
8728
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9130
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9059
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8005
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5977
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4484
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4751
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2129
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.