 |
|
|
 |
|
|
 |
|
|
I started using this class and noticed that my ListViewItem images stopped displaying and I noticed that the column sort arrows didn't display. So I changed ListViewSortManager to not try to use native arrows and the ListViewItem images returned and now the column sort arrows display.
|
| Sign In·View Thread·PermaLink | 1.80/5 (2 votes) |
|
|
|
 |
|
|
I noticed this as well (I'm using Luis' multicolumn version). If I explicitly tell it that native arrows are supported, then both native arrows and my image list works. If they system does the check for the arrows, then my image list does not work. I wonder what code in that check disables the image list?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
i removed the following line from Main.cs : Application.EnableVisualStyles(); and it worked (of course with flat look)
PS: I am working with VS Orcas CTP Express on Windows XP
Amro Khasawneh
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Hi.
When I resize column width for 4 or 5 times (just increase and decrease), the list view will break down and I cannot do anything. I must end task the program from task manager.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
While trying to sort a column that contains file size data, I ran into the problem of sorting integers as text. It obviously doesn't work right (counting 1 - 12, it would sort like this: 1, 11, 12, 2, 3, etc.) So I tried to sort it as an integer field, which gives an error because it can't convert a string to an integer (by string, I mean that the field contains the unit of measure as well...example: 128 KB). So I added this line of code to the Int32 Sorter:
private char[] removeChars = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ~`!@#$%^&*()-=_+".ToCharArray();
lhs = lhs.Trim(removeChars); rhs = rhs.Trim(removeChars);
That seems to work well, with the only exception being that it will not sort any text in the field. Is there a way to properly sort a string containing integers?
For example, if I have two entries: "blah 128 stuff", and "blah 1024 stuff", is there a way to sort so that it knows that the 1024 is larger since it contains a larger integer? I hope I'm not confusing anyone. It's kinda hard to explain 
BTW: This code is awesome! I was hoping there was a way to sort a listview without having to mess with it's ColumnClick method in its parent form. THANKS!
-- modified at 17:03 Monday 28th August, 2006
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
If my memory doesn't fail me, you have to create a custom sorter class derived from ListViewTextSort and override OnCompare(). In OnCompare() you can do all the fancy stuff you need to do.
A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine. - Murphy's Law of Computing
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
This may be a stupid question, but I have not been a member of this site very long and I figure I will be on the safe side and ask it. I am developing a widget for a class that I am a TA for and I am using the sort manager code. Since I do not know a lot about copyright, I was wondering if I need the author's explicit consent in order to use this code in my widget? Any help or advice would be appreciated. Thanks.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I don't remember all the rules but, you don't need my explicit permission to use this control.
A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine. - Murphy's Law of Computing
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
Hello , I have many question in mind to share with you.
1. Can one use the column header colored (every column color custmization) 2. Can one use the combobox/drop down as in header to sort. 3. Can one use the AutoFilter in listview?
Looking these question, the project seems to fulfill only a bit among byte.
Thanks & Regards Anil Kumar
Anil Kumar
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
you make no sense.
1. can you cook a soft boiled egg? 2. can chickens fly?
Looking these question, the project seems to fulfill only a bit among byte.
what does irrelevant mean to you?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
ME and U  When I Take a long time to finish, I am slow, When U takes a long time, u r thorough When I don't do it, I am lazy, When U does not do it, u r busy, When I do something without being told, I am trying to be smart, When U does the same, u takes the initiative, When I please U, I am apple polishing, When U pleases ur boss, u r cooperating, When I make a mistake, you're an idiot. When U makes a mistake, u'r only human. When I am out of the office, I am wondering around. When U is out of the office, u'r on business. When I am on a day off sick, I am always sick. When U is a day off sick, u must be very ill. When I apply for leave, I must be going for an interview When U applies for leave, it's because u' r overworked When I do good, U never remembers, When I do wrong, u never forgets
When I make a sense You make no sense.
When I ask a question U ask Can you cook a soft boiled egg?
When I ask More question U still ask Can chickens Fly?
When i m looking these question U seems only to fulfill only a bit among byte.
When nothing is irrelevant to me. U ask what does irrelevant mean to u?
Finally i wanna to share that till u posted ur reply , i already solved 1 of 3 of my problems. and hope to solve all three when needed.
Anil  (PL) 
Anil Kumar Sharma (PL)
-- modified at 0:51 Tuesday 18th July, 2006
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
Hi, You must import [vb] or use [c#] System.Threading & System.Globalization namespaces in the header of modul.
Then, in the constructor part of ur modul [ after InitialComponent()], you must set CultureInfo depending on ur country or you want. More info see MSDN with keyword 'CultureInfo".
Certainly, ur problem will be fixed 100% [like me before]. It's ok
May help u usefully.
Paula G.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
Hi, I was wondering if anyone out there might know how to convert the section of code to vb.net. I am getting an error "Unable to find an entry point named LoadLibrary in DLL kernel32.dll." when I call the lstviewsortManager. Thank you. ------------------------------------ C# Code [DllImport("kernel32.dll")] static extern IntPtr LoadLibrary(string fileName);
[DllImport("kernel32.dll", CharSet=CharSet.Ansi, ExactSpelling=true)] public static extern UIntPtr GetProcAddress(IntPtr hModule, string procName);
[DllImport("kernel32.dll")] static extern bool FreeLibrary(IntPtr hModule);
[DllImport("comctl32.dll")] static extern int DllGetVersion(ref DLLVERSIONINFO pdvi);
static private bool ComCtlDllSupportsArrows() { IntPtr hModule = IntPtr.Zero;
try { hModule = LoadLibrary("comctl32.dll"); if(hModule != IntPtr.Zero) { UIntPtr proc = GetProcAddress(hModule, "DllGetVersion"); if(proc == UIntPtr.Zero) // Old versions don't support this method return false; }
DLLVERSIONINFO vi = new DLLVERSIONINFO(); vi.cbSize = Marshal.SizeOf(typeof(DLLVERSIONINFO));
DllGetVersion(ref vi);
return vi.dwMajorVersion >= 6; } finally { if(hModule != IntPtr.Zero) FreeLibrary(hModule); } }
------------------------------------ VB.net Code Private Declare Function LoadLibrary Lib "kernel32.dll" (ByVal fileName As String) As IntPtr
Public Declare Function GetProcAddress Lib "kernel32.dll" (ByVal hModule As IntPtr, ByVal procName As String) As UIntPtr
Private Declare Function FreeLibrary Lib "kernel32.dll" (ByVal hModule As IntPtr) As Boolean
Private Declare Function DllGetVersion Lib "comctl32.dll" (ByRef pdvi As DLLVERSIONINFO) As Integer
Private Shared Function ComCtlDllSupportsArrows() As Boolean Dim hModule As IntPtr = IntPtr.Zero Try hModule = LoadLibrary("comctl32.dll") '***ERROR HERE - Unable to find an entry point named LoadLibrary in DLL kernel32.dll. *** If Not (hModule.Equals(IntPtr.Zero)) Then Dim proc As UIntPtr = GetProcAddress(hModule, "DllGetVersion") If (proc.Equals(UIntPtr.Zero)) Then Return False End If End If Dim vi As DLLVERSIONINFO = New DLLVERSIONINFO vi.cbSize = Marshal.SizeOf(GetType(DLLVERSIONINFO)) DllGetVersion(vi) Return (vi.dwMajorVersion >= 6) Finally If Not (hModule.Equals(IntPtr.Zero)) Then FreeLibrary(hModule) End If End Try End Function -----------------------------------------------
eatwork
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
I'm sure you've gotten your answer by now but for some that may not know in VB.NET a Declare Function of these types work best when you Automate them like this>>
Private Declare Auto Function LoadLibrary Lib "kernel32.dll" (ByVal fileName As String) As IntPtr
Public Declare Auto Function GetProcAddress Lib "kernel32.dll" (ByVal hModule As IntPtr, ByVal procName As String) As UIntPtr
Private Declare Auto Function FreeLibrary Lib "kernel32.dll" (ByVal hModule As IntPtr) As Boolean
Private Declare Auto Function DllGetVersion Lib "comctl32.dll" (ByRef pdvi As DLLVERSIONINFO) As Integer
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
small error for the GetProcAddress it should be Ansi
Private Declare Ansi Function GetProcAddress Lib "kernel32.dll" (ByVal hModule As IntPtr, ByVal procName As String) As UIntPtr
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I found that the arrows programatically drawn by this class are overwritten by the 0th and 1st images in the imagelist I have attached to my ListView. Has anyone else experienced this? I have debugged through the sort manager class all the way to the SendMessage to user32.dll, and the arrow bitmaps are successfully added to the imagelist created within the sort manager class, but the ListView displays images from the imagelist attached to it. I would appreciate some help.
Thanks!
MGrant
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Thanks Eddie for the great code! I added a code to prevent sorting of a column having null instead of a Comparer. Like this:
m_sortMgr = new ListViewSortManager( m_list, new Type[] { typeof(ListViewInt32Sort), typeof(ListViewTextSort), null, // <- !!! typeof(ListViewDateSort) }, 0, SortOrder.Ascending ); To process this situation I added a check for null:
public void Sort(Int32 column, SortOrder order) { if (column < 0 || column >= m_comparers.Length) throw new IndexOutOfRangeException(); if (m_comparers[column] == null) return; Regards
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Good stuff, works splendidly.
Small typos in article: m_sortMgr = new ListViewSortManager(m_list, new Type[] { typeof(ListViewTextSort), typeof(ListViewTextCaseInsensitiveSort), typeof(ListViewIntegerSort), typeof(ListViewFloatSort), typeof(ListViewDateSort) } );
Wout
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |