KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

ListView Sorting - Cont
Goto page 1, 2  Next
 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Apr 16, 2007 4:15 pm    Post subject: ListView Sorting - Cont Reply with quote

Just opening this up again for discussion/comment. Will have to work-out where we left off ... will post more soon ...
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Mon Apr 16, 2007 5:27 pm    Post subject: Reply with quote

I think that at one point someone asked for the option to choose a human sort rather than just a bubble sort, I don't think that we would want to get rid of the bubble sort just be able to choose. I may not be something we can have but it doesn't hurt to ask.
_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
masken
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 14 Mar 2003
Posts: 202
Location: Gothenburg, Sweden

PostPosted: Mon Apr 16, 2007 8:13 pm    Post subject: Reply with quote

shawn's up for the beer hehe Very Happy

Here's the thread:
http://www.kixforms.org/forum/viewtopic.php?t=1425
Back to top
View user's profile Send private message MSN Messenger
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Tue Apr 17, 2007 7:19 am    Post subject: Reply with quote

I did write a listview columnsorter for VB .Net a few months ago... had to write a class for that. Here's my class, hope it'll help:
Code:

Public Class ListViewColumnSorter
    Implements System.Collections.IComparer

    Private ColumnToSort As Integer
    Private OrderOfSort As SortOrder
    Private ObjectCompare As CaseInsensitiveComparer

    Public Sub New()
        ' Initialize the column to '0'.
        ColumnToSort = 0

        ' Initialize the sort order to 'none'.
        OrderOfSort = SortOrder.None

        ' Initialize the CaseInsensitiveComparer object.
        ObjectCompare = New CaseInsensitiveComparer()
    End Sub

    Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements IComparer.Compare
        Dim compareResult As Integer
        Dim listviewX As ListViewItem
        Dim listviewY As ListViewItem

        ' Cast the objects to be compared to ListViewItem objects.
        listviewX = CType(x, ListViewItem)
        listviewY = CType(y, ListViewItem)
        ' Compare the two items.
        compareResult = ObjectCompare.Compare(listviewX.SubItems(ColumnToSort).Text, listviewY.SubItems(ColumnToSort).Text)

        ' Calculate the correct return value based on the object
        ' comparison.
        If (OrderOfSort = SortOrder.Ascending) Then
            ' Ascending sort is selected, return typical result of
            ' compare operation.
            Return compareResult
        ElseIf (OrderOfSort = SortOrder.Descending) Then
            ' Descending sort is selected, return negative result of
            ' compare operation.
            Return (-compareResult)
        Else
            ' Return '0' to indicate that they are equal.
            Return 0
        End If
    End Function

    Public Property SortColumn() As Integer
        Set(ByVal Value As Integer)
            ColumnToSort = Value
        End Set
        Get
            Return ColumnToSort
        End Get
    End Property

    Public Property Order() As SortOrder
        Set(ByVal Value As SortOrder)
            OrderOfSort = Value
        End Set
        Get
            Return OrderOfSort
        End Get
    End Property
End Class

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
masken
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 14 Mar 2003
Posts: 202
Location: Gothenburg, Sweden

PostPosted: Tue Apr 24, 2007 11:59 am    Post subject: Reply with quote

Beer bump.

Give me your address shawn (PM), I'm serious, I'll send you some beer hehe Smile

then you can change the EULA to "BeerWare" :p
Back to top
View user's profile Send private message MSN Messenger
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Tue Apr 24, 2007 2:23 pm    Post subject: Reply with quote

Found a problem with my columnsorter Sad
It works fine, but as soon as you use the Anchor property the columnsorter stops working for some reason.

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Apr 24, 2007 3:27 pm    Post subject: Reply with quote

We'll get this listview autosort going - no worries there.

This Anchor thing /w ListView sorting class though - that is weird. Cant see how Anchoring would effect sorting eh ?
Back to top
View user's profile Send private message
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Tue Apr 24, 2007 3:49 pm    Post subject: Reply with quote

Shawn wrote:
This Anchor thing /w ListView sorting class though - that is weird. Cant see how Anchoring would effect sorting eh ?


Me neither, can't seem to pinpoint where tanchoring has any effect on my class.

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Thu Apr 26, 2007 7:22 am    Post subject: Reply with quote

Figured it out, it has been a long time since I worked on that project but in the designer generated code lies the problem. I had to add custom code to the designer generated code wich gets overwritten/deleted once there are changes made in the design, such as properties or new tools etc.
_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
masken
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 14 Mar 2003
Posts: 202
Location: Gothenburg, Sweden

PostPosted: Wed May 09, 2007 12:17 pm    Post subject: Reply with quote

mmm... beer...
Back to top
View user's profile Send private message MSN Messenger
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Fri May 11, 2007 7:06 am    Post subject: Reply with quote

masken wrote:
mmm... beer...

While your at it......

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
masken
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 14 Mar 2003
Posts: 202
Location: Gothenburg, Sweden

PostPosted: Mon May 28, 2007 11:44 am    Post subject: Reply with quote

Shawn, we're getting down to the last few bottles here Wink
Back to top
View user's profile Send private message MSN Messenger
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Fri Jul 27, 2007 1:50 pm    Post subject: Reply with quote

Question
Did anything ever get resolved and working with this as it is beyong my meagre abilities to convert from VB ?
________
WEBSITE HOST


Last edited by MACE1 on Fri Feb 18, 2011 5:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Fri Jul 27, 2007 6:49 pm    Post subject: Reply with quote

Opps yeah - see other response - lets get er done somehow.
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Aug 01, 2007 3:15 pm    Post subject: Reply with quote

Check-out the lastest development build. Listview column sorting (by string) is now built-in to the control. One can turn it off with the AllowSorting property ... Next build will have sorting by different builtin "types" - ie, numeric, text, datetime.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group