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 

Event handler

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



Joined: 09 Jun 2010
Posts: 21

PostPosted: Tue Jun 29, 2010 2:52 pm    Post subject: Event handler Reply with quote

I'm using a System.Windows.Forms.LinkLabel as a cell editor with the label of "Edit" and what I would like to happen is that when the link is clicked then the Record ID of the row would be pasted to a new form. I can't seem to find an event that will fire when the linked is clicked. Can you please point me in the right direction. Does not seem to work even with Mouseup.
Thanks
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Jun 29, 2010 11:30 pm    Post subject: Reply with quote

The editor control that you define in the designer is just a template for creating the controls that Virtual Tree will actually use. For this reason events that you attach to the template control aren't fired (since it isn't the actual control being used). To attach event handlers to an editor control you need to handle the CellEditor.InitializeControl event and attach the control specific event handler inside that.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
morgenweck



Joined: 09 Jun 2010
Posts: 21

PostPosted: Wed Jun 30, 2010 1:03 am    Post subject: Reply with quote

Is there a sample somewhere? Maybe in VB?

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



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Jun 30, 2010 1:32 am    Post subject: Reply with quote

The sample projects don't do this - but the code is fairly straight forward. Below is an example:

Code:
Private Sub OnLinkClicked(ByVal sender As Object, ByVal e As LinkLabelLinkClickedEventArgs)
    ' handle link visit here
End Sub

Private Sub linkEditor_InitializeControl(ByVal sender As System.Object, ByVal e As CellEditorInitializeEventArgs) Handles linkEditor.InitializeControl
    If e.NewControl Then
        Dim sLinkLabel As LinkLabel = CType(e.Control, LinkLabel)
        AddHandler sLinkLabel.LinkClicked, AddressOf OnLinkClicked
    End If
End Sub
 

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



Joined: 09 Jun 2010
Posts: 21

PostPosted: Wed Jun 30, 2010 1:39 am    Post subject: Reply with quote

Perfect Thanks
Back to top
View user's profile Send private message
morgenweck



Joined: 09 Jun 2010
Posts: 21

PostPosted: Wed Jun 30, 2010 2:08 pm    Post subject: Reply with quote

a bit of a problem. I have added e.Control.Tag = e.CellWidget in the InitializeControl but when I drag the row to a new area that is not originally visible it seems that the referrence to the e.cellwidget is dropped. I may not be doing this the best way but I need some kind of reference to the row after the drag and drop. I'm using in the onclick

Dim sLinkLabel As LinkLabel = CType(sender, LinkLabel)

Dim cw As Infralution.Controls.VirtualTree.CellWidget = CType(sLinkLabel.Tag, Infralution.Controls.VirtualTree.CellWidget)
Dim Research As ResearchObjectInfo = CType(cw.Row.Item, ResearchObjectInfo)

But the cw.row.item comes back as nothing after the drop outside the original visible area. Is there a work around or perhaps a better approach I should be using for this?

Thanks
Back to top
View user's profile Send private message
morgenweck



Joined: 09 Jun 2010
Posts: 21

PostPosted: Wed Jun 30, 2010 2:43 pm    Post subject: Reply with quote

I think it fixed. I replaced
Dim Research As ResearchObjectInfo = CType(cw.Row.Item, ResearchObjectInfo)
with
Dim Research As ResearchObjectInfo = CType(VirtualTree.SelectedRow.Item, ResearchObjectInfo)

and everything seems to work

Thanks
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