Profile Picture

NTreelist formatting Date

Posted By Gary Smith 15 Years Ago
Author
Message
Gary Smith
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 39, Visits: 1

Thanks Angel,

It works as designed and I appreciate your help! I'm learning and it is getting easier to understand the classes/controls. Appreciate the help!

Gary

 



Angel Chorbadzhiev
Posted 15 Years Ago
View Quick Profile
Supreme Being

Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 139, Visits: 184

Hi Gary,

Sorry for the delayed responce.

Regarding sorting, the problem is that now the dates are presented as strings and the are sorted as strings.

To fix this you should create a new class that represent short formatted date item and also you should made small modifications of the class that you create earlier.

The new class should looks like this:

Public Class NTreeListNodeShortDateTimeSubItem

    Inherits NTreeListNodeDateTimeSubItem

    Public Overrides ReadOnly Property DisplayValue() As String

        Get

            Return CDate(Value).ToShortDateString()

        End Get

    End Property

End Class

and now MyNTreeListTableData should looks like the following:

Public Class MyNTreeListTableData

    Inherits NTreeListTableData

    Protected Overrides Function CreateSubItem(ByVal value As Object) As Nevron.UI.WinForm.Controls.NTreeListNodeSubItem

        Dim item As NTreeListNodeSubItem = MyBase.CreateSubItem(value)

        If value.GetType() Is GetType(DateTime) Then

            item = New NTreeListNodeShortDateTimeSubItem()

            TryCast(item, NTreeListNodeShortDateTimeSubItem).Value = value

        End If

        Return item

    End Function

End Class

These changes should fix the sorting problem.

Sorry that I didn't foresee it at the beginning.

 

Regarding selection retrieving you should attach to ItemNotify event and check for the appropriate notify code.

Again, here is an example:

Private Sub NTreeList1_ItemNotify(ByVal sender As System.Object, ByVal data As NLightUIItemNotifyData) Handles NTreeList1.ItemNotify

    If data.NotifyCode = NTreeList.ItemLabelDoubleClickNotifyCode Then

        MessageBox.Show(TryCast(data.Sender, NTreeListNode).SubItems(0).RawData)

    End If

End Sub

The drawback here is that you cannot determine on which column is clicked, so you have to know which columns data you want to retreve. At the example above this should be the first one (SubItems(0)).

I hope this will helps.

Along with the documentation you can check the example application provided in the instalation that shows how to use the most common functionality of our UI controls.

Regards,

Angel.

 



Gary Smith
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 39, Visits: 1

This is still a problem (sorting)... any ideas?

 



Gary Smith
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 39, Visits: 1

Sheesh, I feel so stupid!  Ok Angel, now that I have the list populated, looks great (minus the sorting order thing)... I can not find any documentation on methods of retrieving values. If someone double clicks or highlights an item, how do I know what line they selected, and how do I get a value out of one of the columns? (say I need the data in column3 of the selected line)...?  Sorry but if I could find docs this probbably wouldnt be a big problem (I was using the windows listview but I want to utilize your controls where possible), but I cant read by class porperties etc to find methods. (I did check the demo, but nothing shows how to obtain the data when you select it...)

 

Thanks once again!



Gary Smith
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 39, Visits: 1

Angel, the display works perfectly, however - there is a glitch in the sorting of the dates. When the data comes in it is displayed as:

10/1/2009
8/5/2009
8/3/2009
8/1/2009
7/1/2009

If I press the header above the dates for sorting, The dates now look like:

10/1/2009
7/1/2009
8/1/2009
8/5/2009
8/3/2009

Where the first date is out of order, but the others are in correct order... wierd? Ideas?



Gary Smith
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 39, Visits: 1

Perfect Angel... just as I needed... Thanks for the explanation, as usual - you guys are right there..!

Appreciate it!

Gary

 



Angel Chorbadzhiev
Posted 15 Years Ago
View Quick Profile
Supreme Being

Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 139, Visits: 184

Hi Gary,

When you try to bind data to NTreeList you usually do the following:

Dim data As NTreeListTableData = New NTreeListTableData()

data.Table = myDataTable

data.Bind(NTreeList1)

Now instead of using NTreeListTableData use the class above (MyNTreeListTableData):

Dim data As MyNTreeListTableData = New MyNTreeListTableData()

data.Table = myDataTable

data.Bind(NTreeList1)

And because in MyNTreeListTableData the way DateTime type is displayed was overridden with the desired DateTime format, your DateTime values will be displayed in this format.

Regards,

Angel.



Gary Smith
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 39, Visits: 1

Hi Angel, Got all my other issues taken care of and now I'm dealing with the treelist again.

 

MyNTreeListTableData

I attempted to utilize this function you provided, but I have no idea how or where to use it. Can you explain?  Is there any documentation on the Tree List? I couldnt find any.... But if you can explain how to utilize the formating sub class you provided I would be much appreciative! Thanks!

 

Gary

 



Gary Smith
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 39, Visits: 1

Thanks Angel, but I dont even have vs2005...lol... Installing the 2008 version solved the problem. Thanks again...

 

Gary

 



Angel Chorbadzhiev
Posted 15 Years Ago
View Quick Profile
Supreme Being

Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 139, Visits: 184

Hi Gary,

Both can work together. You can keep Nevron .NET Vision for  VS2005 installed if you are going to use VS2005. Otherwise you can uninstall it.

Regards,

Angel.





Similar Topics


Reading This Topic