MajP
You've got your good things, and you've got mine.
- Local time
- Today, 08:04
- Joined
- May 21, 2018
- Messages
- 4,544
It is just code so it does a lot but code does not take up much room.And it's still less than a mega in size
It is just code so it does a lot but code does not take up much room.And it's still less than a mega in size
Update 7
Added Right click function
1) Command bar when off node
2) Command bar when over node
Duplicates a lot of the other functions
Do you have any icons you want? THey should be 32X32 pixel BMPs. With Drag and drop it will be very hard to modify the images per level of node. View attachment 79467
You could write to the table on close, or you could calculate show it on the fly. Where and how do you want to display this. You could do it in a query, but the information would come from the tvw. I could be done, but you would need a function on the form. The query calls the function passing in the PK and gets the level back.In a query, how do you extract the "Get Level" value for each record that you are able to obtain with the button click? I wish it was as easy as SelectedNodeLevel([E2E_ID]), but that didn't work
Public Sub LoadImages()
Dim nd As Node
For Each nd In TVW.Nodes
nd.Image = DLookup("ResponsibleUnit", "t_E2e", "E2E_ID = " & TVW.getNodePK(nd))
Next nd
End Sub
Thank you again. Nice visual.I do not think logically tying an image to a PK would make sense. Instead I assumed these were taskings an added a field "ResponsibleUnit" (Command) to the table. Then I simply gave the tasks assignements. TRADCOC, FORSCOM, AFC, AMC. I named the bitmaps the same as the commands. So the code is simply this for loading the images
Code:Public Sub LoadImages() Dim nd As Node For Each nd In TVW.Nodes nd.Image = DLookup("ResponsibleUnit", "t_E2e", "E2E_ID = " & TVW.getNodePK(nd)) Next nd End Sub
I do not know why I thought adding the images was hard. It is simply associating the imagelist with the treeview and then using the name of the image.
View attachment 79486
Private Sub tvw_RightClickOffNode()
createCommandBarPopUpNoNode Me, Me.TVW
End Sub
Private Sub tvw_RightClickOnNode(PK As Variant)
Me.TVW.TreeView.Nodes("E2E" & PK).Selected = True
createCommandBarPopUpNode Me, Me.TVW
End Sub
Private Sub tvw_RightClickOffNode()
Me.TVW.TreeView.Nodes("E2E" & PK).Selected = True
createCommandBarPopUpNode Me, Me.TVW
End Sub
Private Sub mTVW_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As stdole.OLE_YPOS_PIXELS)
Dim NodeHit As Node
If Button = 2 Then
Set NodeHit = mTVW.HitTest(x, y)
If Not NodeHit Is Nothing Then
RaiseEvent RightClickOnNode(Me.getNodePK(NodeHit))
Else
RaiseEvent RightClickOffNode
End If
End If
End Sub
Private Sub mTVW_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As stdole.OLE_YPOS_PIXELS)
Dim NodeHit As Node
If Button = 2 Then
Set NodeHit = mTVW.HitTest(x, y)
If Not NodeHit Is Nothing Then
RaiseEvent RightClickOffNode
Else
RaiseEvent RightClickOnfNode(Me.getNodePK(NodeHit))
End If
End If
End Sub
strSql = "Update t_E2E SET Level_ID = '" & LevelID & "', [Level] = " & TVW.GetNodeLevel(TVW.getNode("E2E" & PK)) & " WHERE E2E_ID = " & CLng(PK)