CListCtrl
-
Hi I was wondering if some one could help me with the sort function of CList control. My first column consists of numbers to be added by the user. I need the numbers to be sorted but If I make the member variable integers I am unable to use the InsertItem function so am I restricted to CStrings?:confused:
-
Hi I was wondering if some one could help me with the sort function of CList control. My first column consists of numbers to be added by the user. I need the numbers to be sorted but If I make the member variable integers I am unable to use the InsertItem function so am I restricted to CStrings?:confused:
Catherine... were you referring to sorting a CList or CListCtrl?
-
Catherine... were you referring to sorting a CList or CListCtrl?
I have an Edit control where the user enters a number. When the user presses return the number gets added to a CListCtrl. The edit control's member variable is a CString. I want the numbers in the ListCtrl to be sorted numerically, however by selecting ascending sort on the ListCtrl the nubers appear for example in this order: 1 2 22 3 4
-
I have an Edit control where the user enters a number. When the user presses return the number gets added to a CListCtrl. The edit control's member variable is a CString. I want the numbers in the ListCtrl to be sorted numerically, however by selecting ascending sort on the ListCtrl the nubers appear for example in this order: 1 2 22 3 4
it sounds like you might need to convert your CStrings to ints (using the atoi()) during your sort function, something similar to: int n1 = atoi((const char*) pListCtrl->GetItemText(lParam1, 0)); int n2 = atoi((const char*) pListCtrl->GetItemText(lParam2, 0)); then doing the comparision on the ints.