Hi there,

I'm making a settings dialog for my application but I'm having a problem figuring out how to implement it. I'm trying to make a settings dialog that has a treeview on the left-hand side, clicking on the nodes of the treeview would switch the dialog background based on which node was clicked. An ecample of a popular application that implements this kind of settings dialog is uTorrent.

My question is, how do I implement this? My best guess is that I would have to determine which node was clicked and repaint the dialog background to show the controls/windows associated with that node. If this is the case, do i have to create the controls for every possible node on the tree view and show/hide and then repaint every time a tree view node is clicked?

Most programs will use the Microsoft Treeview Control. Here is some sample code. The treeview control generates an OnClick event and one of its parameters is the node that was clicked.

Thank you for the reply.

I was able to successfully implement a treeview control and populate it with nodes, I can determine which node was clicked using the WM_NOTIFY TVM_SELCHANGD message. However, I am not sure where to go from there. It seems that I would want to make specific buttons disappear or reappear based on which treeview node is clicked, right? I guess my question is more along the lines of the overall strategy I need to implement this behavior. Should I ....

#1
Create all the buttons/comboboxes/edit controls that my settings dialog is going to use for every possble treeview node when WM_INITDIALOG is called. Then make them visibile/invisible based on the treeview node that is selected and then repaint.

#2
Create the buttons/comboboxes/edit controls that my settings dialog is going to use in realtime, as the user selects the node of the treeview.

In other words, my settings dialog must change everytime a new treeview node is clicked (user clicks on the treeview node labled "general", the settings dialog must display the buttons/comboboxes that have my applications general settings, then if user clicks on the treeview node labled "TCP/IP", the settings dialog must remove the "general" settings display and display the buttons/comboboxes that have my applications TCP/IP settings,). What is the best way to do this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.