list control problem
hello
I am trying to make a list control , so that it will display both name and
number when i enter them.
1) how do i delete an item from the list control
ie
void CSpeedDial::OnSpeedDel()
{
//
}
2)how do i move an item up or down in the list contol using "up buttom" and
"down buttom" i have created
ie
void CSpeedDial::OnSpeedUp()
{
}
and
void CSpeedDial::OnSpeedDown()
{
}
3)how do i make the "add buttom" disable when i have 8 items in the list
control.
this is what I have done so far:
BOOL CSpeedDial::OnInitDialog()
{
CDialog::OnInitDialog();
CRect rect;
m_speedList.GetClientRect(&rect);
m_speedList.InsertColumn(0,_T("Name"),LVCFMT_LEFT,rect.Width()/2,0);
m_speedList.InsertColumn(1,_T("Number"),LVCFMT_LEFT,rect.Width()/2,0);
m_speedList.SetImageList(&imList, LVSIL_SMALL);
for (int i=0;i< m_speedArray.GetSize();i++)
{
m_speedList.InsertItem(i,m_speedArray.GetAt(i));
}
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSpeedDial::OnSpeedAdd()
{
// TODO: Add your control notification handler code here
CString AliasName,AliasNumber;
m_speedName.GetWindowText(AliasName);
m_speedNumber.GetWindowText(AliasNumber);
AliasName.TrimRight();
AliasName.TrimLeft();
AliasNumber.TrimLeft();
AliasNumber.TrimRight();
if(AliasName.FindOneOf("=|")>=0) return;
int nIndex = m_speedList.InsertItem(m_speedList.GetItemCount(),AliasName);
m_speedList.SetItemText(nIndex,1,AliasNumber);
m_speedName.SetWindowText(_T(""));
m_speedNumber.SetWindowText(_T(""));
}
thanks for you help