Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Treeview node not highlighted in Windows 7 - Vista OK

Posted on 2012-03-22
3
Medium Priority
?
481 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 49

Accepted Solution

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

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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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 …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

972 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