how can i do that, i am very new in programming
jokefake
Posts
-
retain items in the list control -
retain items in the list controlhow do i retain items in the list control so that even when i close the application, the items would still be availiable in the list control.
-
list controlstrCommand contains the correct string. i think the problem have to do with the SetWindowText. do you have any suggestion of what i can do. -- modified at 6:02 Wednesday 12th July, 2006
-
list controldo i have to do changes to the last code. the text on the 2nd column are not showing m_cListCtrl.SetItemText(nIndex-1,1, strCommand2);
-
list controli did sth like this and the result was no good at all void CTestingDlg::OnUp() { int nIndex; CString strCommand,strCommand2; nIndex = m_cListCtrl.GetNextItem(-1, LVNI_SELECTED); ASSERT(-1 != nIndex); strCommand = m_cListCtrl.GetItemText(nIndex, 0); strCommand2 = m_cListCtrl.GetItemText(0,nIndex); m_cListCtrl.DeleteItem(nIndex); nIndex = m_cListCtrl.InsertItem(nIndex - 1, strCommand); m_cListCtrl.SetItemText(nIndex-1,1, strCommand2); }
-
list controlthanks, it works perfectly with a list with only one column, what about if you have 2 columns
-
list controldeleting it first, deletes the row as i click on the buttom i extracted my code from here. BOOL CListCtrlEx::MoveRow(int from, int to) { //Can't move to the same place, or from or to a negative index if(from == to || from < 0 || to < 0) return FALSE; //First Copy the row to the new location if(CopyRow(from, to)) { //If we have just inserted a row before //this one in the list, we need to increment //our index. if(from > to) DeleteItem(from + 1); else DeleteItem(from); return TRUE; } else return FALSE; } BOOL CListCtrlEx::CopyRow(int from, int to) { //Can't move to the same place, or from or to a negative index if(from == to || from < 0 || to < 0) return FALSE; //Copy the row to the new index InsertItem(to, GetItemText(from, 0)); //If row has been inserted before original //increment the original if(from > to) from++; //Loop through subitems for(int i = 1; i < GetColumnCount(); i++) { SetItemText(to, i, GetItemText(from, i)); } return TRUE; }
-
list controlthanks, that code is really short and simple. I tried moving a selected item up in the list control, but it is not working. what may wrong with the code void CTestingDlg::OnUp() { int index = m_cListCtrl.GetNextItem(-1, LVIS_SELECTED); m_cListCtrl.InsertItem(index -1, m_cListCtrl.GetItemText(index, index)); m_cListCtrl.DeleteItem(index +1); // TODO: Add your control notification handler code here }
-
list controli just removed some of the lines from the code void CSpeedDial::OnSpeedDelete() { POSITION pos = m_speedList.GetFirstSelectedItemPosition(); int index = m_speedList.GetNextSelectedItem(pos); m_speedList.DeleteItem(index); // TODO: Add your control notification handler code here } but how can i move an item up and down in the list i am a beginner
-
list controlthanks it is now working
-
list controli try sth like this but is not working void CSpeedDial::OnSpeedDelete() { POSITION pos = m_speedList.GetFirstSelectedItemPosition(); if(pos == NULL) return; int index = m_speedList.GetNextSelectedItem(pos); if(index<0 || index>m_speedList.GetItemCount()|| m_speedList.GetItemCount()!= m_speedArray.GetSize()) return; m_speedList.DeleteItem(index); m_speedArray.RemoveAt(index); // TODO: Add your control notification handler code here }
-
list controli did sth like this but it is not working void CSpeedDial::OnSpeedDelete() { POSITION pos = m_speedList.GetFirstSelectedItemPosition(); if(pos == NULL) return; int index = m_speedList.GetNextSelectedItem(pos); if(index<0 || index>m_speedList.GetItemCount()|| m_speedList.GetItemCount()!= m_speedArray.GetSize()) return; m_speedList.DeleteItem(index); m_speedArray.RemoveAt(index); // TODO: Add your control notification handler code here }
-
list controlhello 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
-
error LNK2001in trying to use the wave class in a program, i had this error message. I need help on how to resolve it. Thanks error LNK2001: unresolved external symbol "public: struct tWAVEFORMATEX __thiscall CWave::GetFormat(void)const " (?GetFormat@CWave@@QBE?AUtWAVEFORMATEX@@XZ)