Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SET focus on node treeview 2

Status
Not open for further replies.
>when i lick on a node to dont set focus the node?

How then do you expect the user to select items in the tree?

> a blue rectangle, i dont love tath...

Are yuo saying you just don 't want the blue rectangle at all? That you'd prefer a different colour? What?

Again, if you wreck the expected behaviour of the control how do your users know what is or is not selected?

The cherapest (but not perfect) of doing this is to use a dummy control. e.g add a textbox, (perhaps call it 'TreeViewProxie'), disable tabstop for it, then hide it behind the treeview (or another control). Do NOT set its Visible property to false, as then the trick we are using here won't work. Now add the following code for the treeview's click event

Code:
[COLOR=blue]Private Sub TreeView1_Click()
    TreeViewProxie.SetFocus
End Sub[/color]

As I say, far from perfect, and may require rewriting some of your code if you are already using the Click event for anything. Otherwise you have to resort to OwnerDraw (which we have previously illustrated to you for the ListView control)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top