Solved

Treeview node not highlighted in Windows 7 - Vista OK

Posted on 2012-03-22
3
474 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye 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 48

Expert Comment

by:Dale Fye
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

628 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