soma drug can i buy soma online - soma in urine drug screen
ReplyI do it following the steps above. I derive a class CMListCtrl from CListCtrl and then go as the steps. At last, I declare a variable CMyListCtrl m_list which is from resource. I insert three columns but when I click the headers, nothing happened. Can anyone tell me the reason? If send me the source code, this is very good.
The notification is sent to the parent - usually a dialog. You'll need to read up on the reflection mechanism (the MFC one, not the .NET one).
ReplyWhat is the SortTextItems doing? how do you sort the list? (manually? do a predefined method exist already?)
I just call my method RefreshList(), which I use in several places. It does the following:
1. creates a Clist of any selected items
2. Clears the CListCtrl
3. Requests & populates list data afresh
4. Uses the CList from 1. to restore the selected items
5. Calls my method - SortList()
SortList() is just a switch which sets a function pointer to the appropriate compare-function to sort based on the selected column. It then calls CListCtrl::SortItems - the CListCtrl's built-in sort method:
void CMyDlg::SortList()
{
PFNLVCOMPARE pfnCompare = NULL; // Pointer to compare function
switch( m_nSortedCol )
{
case COLUMN_PROMPT_ID: // Sort by ID
pfnCompare = CMyDlg::CompareIds;
break;
case COLUMN_PROMPT_NAME: // Sort by file name
pfnCompare = CMyDlg::CompareNames;
break;
case COLUMN_PROMPT_TIME: // Sort by date-time
default:
pfnCompare = CMyDlg::CompareTimes;
break;
}
m_ctrListFailedPrompts.SortItems( pfnCompare, (LPARAM)this );
}
Reply
Originally posted by: Danushka Menikkumbura
This helped me a lot.Nice work.Thanks a lot.
ReplyOriginally posted by: zhangyi
CListSort::CListSort()
CListSort::~CListSort()
/////////////////////////////////////////////////////////////////////////////
/*
int CALLBACK ListCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
{m_fAsc=TRUE;}
{
}
BEGIN_MESSAGE_MAP(CListSort, CListCtrl)
//{{AFX_MSG_MAP(CListSort)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
ON_NOTIFY(HDN_ITEMCLICKA, 0, OnHeaderClicked)
ON_NOTIFY(HDN_ITEMCLICKW, 0, OnHeaderClicked)
END_MESSAGE_MAP()
// CListSort message handlers
void CListSort::OnHeaderClicked(NMHDR* pNMHDR, LRESULT* pResult)
{
HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
if( phdn->iButton == 0 )
{
//设置排序方式
if( phdn->iItem == m_nSortedCol )
m_fAsc = !m_fAsc;
else
m_fAsc = TRUE;
//设置排序的列
m_nSortedCol = phdn->iItem;
//开始排序
SortItems( ListCompare, (DWORD)this );
}
}
typedef struct tagNMHEADER{
NMHDR hdr;
int iItem;
int iButton;
HDITEM FAR* pItem;}
NMHEADER, FAR* LPNMHEADER;
Members
hdr
NMHDR structure that contains information about the notification message.
iItem
Zero-based index of the header item that is the focus of the notification message.
iButton
Index of the mouse button used to generate the notification message. It is one of the following values:
*/
int CALLBACK ListCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
//通过传递的参数来得到CSortList对象指针
CListSort* pV=(CListSort*)lParamSort;
//通过ItemData来确定数据
DEMO_DATA* pInfo1=strAllData+lParam1;
DEMO_DATA* pInfo2=strAllData+lParam2;
CString szComp1,szComp2;
int iCompRes;
switch(pV->m_nSortedCol)
{
case(0):
//以第一列为根据排序
szComp1=pInfo1->szName;
szComp2=pInfo2->szName;
iCompRes=szComp1.Compare(szComp2);
break;
case(1):
//以第二列为根据排序
if(pInfo1->iAge == pInfo2->iAge)iCompRes = 0;
else
iCompRes=(pInfo1->iAge < pInfo2->iAge)?-1:1;
break;
default:
ASSERT(0);
break;
}
//根据当前的排序方式进行调整
if(pV->m_fAsc)
return iCompRes;
else
return iCompRes*-1;
}
Originally posted by: Vikas Hegde
Thank you Zafir...The callback function gave me problems....This saved a lot of my time.A very useful aricle.
Originally posted by: LizardKing
This works great for String or Character based columns however numeric based columns get sorted incorrectly ( I know that this was pointed out in article) - Just wondering has anyone modified it to work on Integer based columns and if so , could they share the knowledge :)
Cheers
LK--<
ReplyOriginally posted by: Ligh56t
It's a good idea to make a message entry by myself.
Thank you to let me know that
Since the HDN_ITEMCLICK is a notification from the header control to the list view control, it is a direct notification and not a reflected one.
Reply
Originally posted by: amit gupta
its very good but we want complete FAQ in a proper sequence
ReplyOriginally posted by: Sheethal Shneoy
Thanks Zafirji,Works absolutel fine.
Reply