Home > Software engineering >  MFC list control scheduling problems
MFC list control scheduling problems

Time:11-18

 

Void Student: : OnBnClickedButton1 ()
{
//TODO: add the control notification handler code

Int p, q;
int i=0;
for (int i=1; i {
Int k=1;
For (int x=0; X & lt; M_List. GetItemCount () - I; X++)
{
P=_ttoi (M_List GetItemText (x, 5));//int cstrings translate into
Q=_ttoi (M_List GetItemText (x + 1), (5));
If (p & lt; Q)
{
Cstrings item;
Item=M_List. GetItemText (x, 5);
M_List. SetItemText (x, 5, M_List GetItemText (x + 1), (5));
M_List. SetItemText ((x + 1), 5, item).
K=0;
}
If (k) break;
}
}
}
This how to prioritize, whole line I exchanged a few lines in the if statement again after five columns not exchange a few lines of the other columns, please god help college students

CodePudding user response:

Int the CALLBACK ListSortCompare (LPARAM lp1, LPARAM lp2, LPARAM Check)
{//lp1, lp2 are the 'ID' the original oders. The iItem will changes
CListCheckDlg * pDlg=(CListCheckDlg *) AfxGetMainWnd ();

Cstrings str1=pDlg - & gt; M_List. GetItemText (lp1 (int), 1);
Cstrings str2=pDlg - & gt; M_List. GetItemText (lp2 (int), 1);
AfxDump & lt; AfxDump & lt; //
If ((STRCMP (ListStr [(int) lp1], Check (char *))==0) & amp; &
((STRCMP (ListStr [(int) lp2], (char *) Check)==0))) return 0;
Else if ((STRCMP (ListStr [(int) lp1], Check (char *))==0)) return 1;
Else if ((STRCMP (ListStr [lp2 (int)], Check (char *))==0)) return 1;
The else return 0;
}

Void CListCheckDlg: : OnColumnclickList1 (NMHDR * pNMHDR, LRESULT * pResult)
{
PNMHDR NM_LISTVIEW * pNMListView=(NM_LISTVIEW *);
//TODO: Add your the control notification handler code here
* pResult=0;
//
Int sb=pNMListView - & gt; The iSubItem;
//fast enough
If (sb==1)
{
M_List. SortItems (ListSortCompare (LPARAM), "zhang");
}
}

CodePudding user response:

Find their own a finally find out in the morning

CodePudding user response:

Is how to make, can say with me, please?
  • Related