newntui/commonresources/src/filterlist.cpp
//----------------------------------------------------------------------------------------
// This callback runs when user press "Change" button. Will remove current filter from 
// the filter list and from the filter array as well.
//----------------------------------------------------------------------------------------
This callback runs when user press "Change" button. Will remove current filter from
the filter list and from the filter array as well.
This callback runs when user press " Change " button . Will remove current filter from the filter list and from the filter array as well .
void CFilterList::OnRemovebutton()  {
int index = m_SaveList.GetCurSel();
CString name;
CString command;
    m_AllFilters.RemoveAt(m_SaveList.GetItemData(index));
    m_SaveList.ResetContent();
	for(register i=0;i<m_AllFilters.GetSize();i++) {
		m_SaveList.SetItemData(m_SaveList.AddString(m_AllFilters[i]->Name),i);
	}
	if(m_SaveList.GetCount()==0) {
		m_ChangeButton.EnableWindow(FALSE);
		m_RemoveButton.EnableWindow(FALSE);
	    m_NameEdit.SetWindowText("");
	    m_CommandEdit.SetWindowText("");
	    SetModified(FALSE);
        SaveFilters();
		return;
	}
    if(m_SaveList.GetCount()<=index) index--;
    int pos = m_SaveList.GetItemData(index);
	m_NameEdit.SetWindowText(m_AllFilters[pos]->Name);
	m_CommandEdit.SetWindowText(m_AllFilters[pos]->Command);
	m_SaveList.SetCurSel(index);
    SaveFilters();
	UpdateParentName();
	SetModified(TRUE);
}
void CFilterList :: OnRemovebutton ( ) { int index = m_SaveList . GetCurSel ( ) ; CString name ; CString command ; m_AllFilters . RemoveAt ( m_SaveList . GetItemData ( index ) ) ; m_SaveList . ResetContent ( ) ; for ( register i = 0 ; i < m_AllFilters . GetSize ( ) ; i ++ ) { m_SaveList . SetItemData ( m_SaveList . AddString ( m_AllFilters [ i ] -> Name ) , i ) ; } if ( m_SaveList . GetCount ( ) == 0 ) { m_ChangeButton . EnableWindow ( FALSE ) ; m_RemoveButton . EnableWindow ( FALSE ) ; m_NameEdit . SetWindowText ( " " ) ; m_CommandEdit . SetWindowText ( " " ) ; SetModified ( FALSE ) ; SaveFilters ( ) ; return ; } if ( m_SaveList . GetCount ( ) <= index ) index -- ; int pos = m_SaveList . GetItemData ( index ) ; m_NameEdit . SetWindowText ( m_AllFilters [ pos ] -> Name ) ; m_CommandEdit . SetWindowText ( m_AllFilters [ pos ] -> Command ) ; m_SaveList . SetCurSel ( index ) ; SaveFilters ( ) ; UpdateParentName ( ) ; SetModified ( TRUE ) ; }
This callback runs when user press "Change" button.
This callback runs when user press " Change " button .