MajP
You've got your good things, and you've got mine.
- Local time
- Today, 11:20
- Joined
- May 21, 2018
- Messages
- 8,933
In relation to this thread
I wanted to see if I could build a functional treeview using a listbox. Something that was reusable and provided real treeview capabilities
1. Multiple levels (more than 2)
2. Expand and collapse
3. Expand and collapse icons
I was surprised at how well it worked and extremely easy to implement. Like usual this is a class module that only requires a line of code for all functionality. The only effort is making a properly formatted query with proper alias columns. This allows it to be reused for any query.
Here is all the code to load two different trees and allow these features. The class does the work.
My issue is that on a normal treeview when you click on the [+], [-] icons to expand or collapse they work. But if you click off the icons you can simply select a node without expanding or collapsing.
My question:
Any idea if there is a way to return the mouse down location and compare to the string to see approximately what is under the mouse. On a normal treeview expand/collapse only happens when you click on the icons to the left of the description. This allows you to be able to select a node by clicking on the description and not trigger and expand and collapse.
I can determine how many characters before the actual Description, if that helps. Example Order 10643 would start at 10 characters in. So if the mouse is less then 10 character width I would expand / collapse. Ideally if the user clicks to the left of the description I would trigger the expand or collapse code. They would not have to be right on the [+],[-]. If they were close to the description I wound not trigger the expand and collapse.
My other option is to simply require a double click for expand and collapse, but this is different behavior then a normal tree.
another tree
Hi
I have list box attached to a table i am trying to achieve a treeview output.
What i am trying to acheive is that when i click on the list box it shows the main category with the sub caategorys in view.
for example:
OVERVIEW
CHART OF ACCOUNTS
to
OVERVIEW
- Immediate window
- Lodgement
- protential Leads
CHART OF ACCOUNTS
but keep comeing with a run time error 3075
Private Sub List3_Click()
'MS ACCESS DETERMINE THE LISTBOX ITEM CLICKED ON CLICKED EVENT
Dim rowIndex As Integer
Dim rowValue As String, iMLBid As String, isub As String
Dim rowIsSelected As...
I have list box attached to a table i am trying to achieve a treeview output.
What i am trying to acheive is that when i click on the list box it shows the main category with the sub caategorys in view.
for example:
OVERVIEW
CHART OF ACCOUNTS
to
OVERVIEW
- Immediate window
- Lodgement
- protential Leads
CHART OF ACCOUNTS
but keep comeing with a run time error 3075
Private Sub List3_Click()
'MS ACCESS DETERMINE THE LISTBOX ITEM CLICKED ON CLICKED EVENT
Dim rowIndex As Integer
Dim rowValue As String, iMLBid As String, isub As String
Dim rowIsSelected As...
- Smiley 3636
- Replies: 17
- Forum: Modules & VBA
I wanted to see if I could build a functional treeview using a listbox. Something that was reusable and provided real treeview capabilities
1. Multiple levels (more than 2)
2. Expand and collapse
3. Expand and collapse icons
I was surprised at how well it worked and extremely easy to implement. Like usual this is a class module that only requires a line of code for all functionality. The only effort is making a properly formatted query with proper alias columns. This allows it to be reused for any query.
Here is all the code to load two different trees and allow these features. The class does the work.
Code:
Private LTVW As New ListboxTreeview
Private Sub cmboLarge_Click()
LTVW.Initialize Me.lstSimulated, "qryNodeLargeEmployees", "TD"
End Sub
Private Sub cmdCategories_Click()
LTVW.Initialize Me.lstSimulated, "qryCustomers_Orders_OrderDetails"
End Sub
My issue is that on a normal treeview when you click on the [+], [-] icons to expand or collapse they work. But if you click off the icons you can simply select a node without expanding or collapsing.
My question:
Any idea if there is a way to return the mouse down location and compare to the string to see approximately what is under the mouse. On a normal treeview expand/collapse only happens when you click on the icons to the left of the description. This allows you to be able to select a node by clicking on the description and not trigger and expand and collapse.
I can determine how many characters before the actual Description, if that helps. Example Order 10643 would start at 10 characters in. So if the mouse is less then 10 character width I would expand / collapse. Ideally if the user clicks to the left of the description I would trigger the expand or collapse code. They would not have to be right on the [+],[-]. If they were close to the description I wound not trigger the expand and collapse.
My other option is to simply require a double click for expand and collapse, but this is different behavior then a normal tree.
another tree
Last edited: