Solved

Treeview node not highlighted in Windows 7 - Vista OK

Posted on 2012-03-22
3
468 Views
Last Modified: 2012-03-22
I have a treeview consisting of a list of products  on the left hand side of screen. When an item in the treeview is selected a subform of the main form to the right of the treeview  displays the details of the item.

When the database runs under Vista if control is lost to the subform, the item on the treeview is still highlighted - less brightly but greyed over. So its still clear to the user where he/she is in the treeview. I dodn't do anything to achieve this - it just happens by default.
 
If my database runs on Windows 7 this semi-highlight is lost completely.

I have searched around the forum and the web but I can't find any way to keep the selected node highlighted when the treeview has lost focus.

In Windows 7 I also lose the horrible grey background to tab control - which I don't mind! - I think the difference to the treeview  might be something to do with this; Any ideas?

Thanks

Lou
0
Comment
Question by:Louverril
  • 2
3 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 37752253
Whenever I use a treeview, I always include the following as the first several lines of the treeview controls NodeClick event.

'make sure the current node is highlighted and selected
Dim tvw As MSComctlLib.TreeView
Set tvw = Me.treeControlName.Object
tvw.DropHighlight = Nothing
tvw.DropHighlight = node
node.Selected = True

   
**Note:
1.  you need to replace "treeControlName" with the name of your treeview control
2.  That last line (Node.Selected = true) is there because there are occasions where I call the NodeClick event to set the focus to the node without actually clicking on it.  You probably don't need that line, but I would definitely include the two DropHighlight lines.
0
 

Author Comment

by:Louverril
ID: 37752808
I must admit I was doubtful that this would work - but it does!

Brilliant.

Thank you very much.

Lou
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 37752888
Lou,

In case you have not already found this site, here is a really good source for treeview stuff.

http://mytreeviewblog.blogspot.com/

I recommend you start with his oldest post and work towards Episode #7.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now