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 

Row resize event?

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



Joined: 21 Oct 2006
Posts: 32

PostPosted: Sun Nov 16, 2008 10:04 pm    Post subject: Row resize event? Reply with quote

Hi,

I was wondering if there was any event that is called when a row header is resized? I would like to keep a track of row widths so that they can be automatically saved each time a change is made. So the next time a user launches the application the row widths they specified earlier are displayed.

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



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Nov 18, 2008 6:18 am    Post subject: Reply with quote

No there isn't an event for this. You'd need to override the the VirtualTree.SetUserRowHeight and ClearUserRowHeights methods to handle this.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
WaqasK



Joined: 21 Oct 2006
Posts: 32

PostPosted: Fri Dec 05, 2008 4:01 am    Post subject: Reply with quote

Infralution wrote:
No there isn't an event for this. You'd need to override the the VirtualTree.SetUserRowHeight and ClearUserRowHeights methods to handle this.


Hi,

Thanks for the info. I've trid implementing the SetUserRowHeight method but I can't seem to get it to work. In the below example I want to set the hieght of all rows in the table to 50:

Code:
 
        Private Sub setRowHeights(ByRef vt As VirtualTree)
        Dim vtRow As Infralution.Controls.VirtualTree.Row
        Dim rowList As IList = Nothing

        For i As Integer = 0 To vt.RootRow.NumChildren - 1
            vtRow = vt.RootRow.ChildRowByIndex(i)
            setUserRowHeight(vtRow, 50)
        Next
    End Sub

    Public Overridable Sub setUserRowHeight(ByVal row As Row, ByVal height As Integer)
        'MsgBox(row.RowIndex.ToString + " " + height.ToString)
    End Sub


What am I doing wrong?

Also, is there a way to get the heights of all rows in a tree?

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



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Fri Dec 05, 2008 9:40 pm    Post subject: Reply with quote

You need to inherit a new class from Virtual Tree and then override the SetUserRowHeight method (using the overrides keyword) in the derived class. This method is only used to set row heights that are changed by the user. If you want to change all the heights of all rows then you would normally set VirtualTree.RowHeight.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
WaqasK



Joined: 21 Oct 2006
Posts: 32

PostPosted: Sat Dec 06, 2008 12:14 pm    Post subject: Reply with quote

Ok, here's what I've got now:

Code:
Public Class rowHeightTree
   Inherits Infralution.Controls.VirtualTree.VirtualTree

   Public Overrides Sub setUserRowHeight(ByVal row As Infralution.Controls.VirtualTree.Row, ByVal height As Integer)
           MsgBox(row.RowIndex.ToString + " " + height.ToString)

   End Sub

   Public Overrides Function getUserRowHeight(ByVal row As Infralution.Controls.VirtualTree.Row) As Integer

       End Function
End Class

in my main class:

Code:

Private Sub setRowHeights(ByRef vt As VirtualTree)
   Dim vtRow As Infralution.Controls.VirtualTree.Row
        Dim rowList As IList = Nothing

        For i As Integer = 0 To vt.RootRow.NumChildren - 1
            vtRow = vt.RootRow.ChildRowByIndex(i)
            Dim mList As New rowHeightTree
            'MsgBox(vtRow.Item)
            mList.setUserRowHeight(vtRow, 25)
        Next
End Sub


But this still does not work for me....
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sun Dec 07, 2008 1:00 am    Post subject: Reply with quote

Because you have overridden the methods if you don't call the base class method then the won't do anything. You should not override the GetUserRowHeight method. eg

Code:
Public Class rowHeightTree
   Inherits Infralution.Controls.VirtualTree.VirtualTree

   Public Overrides Sub SetUserRowHeight(ByVal row As Row, ByVal height As Integer)
           MsgBox(row.RowIndex.ToString + " " + height.ToString)
           MyBase.SetUserRowHeight(row, height)
   End Sub
End Class


You should then find that your derived method is called when the user interactively resizes a row.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
WaqasK



Joined: 21 Oct 2006
Posts: 32

PostPosted: Mon Dec 08, 2008 3:03 pm    Post subject: Reply with quote

Hi,

Thanks for lookng at this again. But I'm afraid it's still not working.

Just to be clear, my aim is to save the heights of each virtual tree row to a database when the virtual tree is closed. When it is reloaded I will get the saved height values from the DB and automatically assign them to the Virtual tree rows. I intended to do this using the SetUserRowHeight method. But is this even possible?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Dec 08, 2008 7:55 pm    Post subject: Reply with quote

Yes this is possible. If you email a sample project demonstrating what you are doing to support@infralution.com we will take a look at it.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
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