Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Two questions

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
tom145



Joined: 11 Nov 2007
Posts: 75

PostPosted: Sun Jan 27, 2008 3:22 pm    Post subject: Two questions Reply with quote

1. I want to add a row which displays totals for columns -- I want to make sure it alway appears as the last child. Is this possible to do.

2. Also when a user double clicks a row no children I want to handle the event and throw up a dialog box. I will need to locate the ActiveRow as well -- can I do this??

Thanks a lot.

Tom
Back to top
View user's profile Send private message
tom145



Joined: 11 Nov 2007
Posts: 75

PostPosted: Sun Jan 27, 2008 7:26 pm    Post subject: Possible Bug Reply with quote

Private Sub _virtualTree_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles VirtualTree.DoubleClick

Dim r As Row = Me.VirtualTree.SelectedRow

If r.NumChildren = 0 Then
Dim node As Object = r.Item
Dim msg As String = node.FieldValue("SEC TYPE")
MsgBox(msg)
End If

End Sub

I added this event handler -- sometimes when I click on a row with no children other rows which are not selected and have children collapse.

Tom
Back to top
View user's profile Send private message
tom145



Joined: 11 Nov 2007
Posts: 75

PostPosted: Sun Jan 27, 2008 8:42 pm    Post subject: Context Menu Question Reply with quote

Hello,

I was able to add a context menu. However, I want the context menu to appear only if the active row has no children and also I want to be able to determine which items will show up in the context menu based on a fieldvalue. How can I do this??

Tom
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Jan 28, 2008 4:30 am    Post subject: Reply with quote

Quote:
I want to add a row which displays totals for columns -- I want to make sure it alway appears as the last child. Is this possible to do.


From you previous posts I believe you are already doing Programmatic binding and handling the GetChildren event. To add additional rows you will need to add the extra objects to the e.Children collection you set in this event handler. This may mean copying the data items to a new collection and adding the total objects and then returning that collection.

Quote:
Also when a user double clicks a row no children I want to handle the event and throw up a dialog box. I will need to locate the ActiveRow as well -- can I do this??


You should handle the CellDoubleClick event. This is only fired when the user double clicks on a cell (ie not when they double click on a header or somewhere else). The e.Sender is CellWidget that was clicked on eg

Code:
Private Sub _virtualTree_CellDoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _virtualTree.CellDoubleClick
    Dim sCellWidget As CellWidget = sender
    If sCellWidget.Row.NumChildren = 0 Then
        MessageBox.Show("No Children!")
    End If
End Sub


Quote:
I was able to add a context menu. However, I want the context menu to appear only if the active row has no children and also I want to be able to determine which items will show up in the context menu based on a fieldvalue. How can I do this??


You need to handle the GetContextMenuStrip event eg

Code:
Private Sub _virtualTree_GetContextMenuStrip(ByVal sender As System.Object, ByVal e As GetContextMenuStripEventArgs) Handles _virtualTree.GetContextMenuStrip
    If e.Row.NumChildren = 0 Then
        e.ContextMenuStrip = myContextMenuStrip
    End If
End Sub

_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
tom145



Joined: 11 Nov 2007
Posts: 75

PostPosted: Mon Jan 28, 2008 1:03 pm    Post subject: Issue Resolved Reply with quote

Thanks as always -- I think the double click issue is resolved.

Tom
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group