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!

Treeview Datawindow Oddity (FYI)

Status
Not open for further replies.

LunaRoja

Programmer
Sep 21, 2010
34
US
Hello,

I thought I would give a shot at contributing something here. I found a strange behavior in the treeview datawindow I would like to share.

I have a treeview datawindow with four levels. If three levels are exposed, but third level is not expanded to show the items in the fourth level, I found I could click in the very middle of the space between two items on level three and, after that, the level three item would not be selected but, if I expanded level three exposing level four, I would find one of the items on level four selected.

To get around this, I put the following code in the treenodeselecting event. If an item from level four is selected but level three is is not expanded (level four items are not exposed), the selection terminates.

=====================================================================
If grouplevel = 4 And Not isExpanded (row, 3) Then
// return code other than 0 cancels selection operation...
Return -1
End If
=====================================================================

It is simple, but effective.

LR
 
A bit more genericized:

// only check if grouplevel > 1
If grouplevel > 1 Then
If Not isExpanded (row, grouplevel - 1) Then
// return code other than 0 cancels selection operation...
Return -1
End If
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top