newntui/commonresources/src/filterlist.cpp
//----------------------------------------------------------------------------------------
// This callback runs when user press "Add" button. Will insert the name from the
// name edit field and command from the command edit field into filter list and will
// save this list in the archive.
//----------------------------------------------------------------------------------------
This callback runs when user press "Add" button. Will insert the name from the
name edit field and command from the command edit field into filter list and will
save this list in the archive.
This callback runs when user press " Add " button . Will insert the name from the name edit field and command from the command edit field into filter list and will save this list in the archive .
void CFilterList::OnAddbutton()  {
CFilterEntry* newEntry = new CFilterEntry;
    m_NameEdit.GetWindowText(newEntry->Name);
	newEntry->Name.TrimLeft();
	newEntry->Name.TrimRight();
	if(newEntry->Name.GetLength()==0) {
		MessageBox("Can't save unnamed filter.","Add",MB_ICONSTOP|MB_OK);
		return;
	}
    m_CommandEdit.GetWindowText(newEntry->Command);
    int pos = m_AllFilters.Add(newEntry);
    int index = m_SaveList.AddString(newEntry->Name);
	m_SaveList.SetItemData(index,pos);
    m_SaveList.SetCurSel(index);
	m_ChangeButton.EnableWindow(TRUE);
	m_RemoveButton.EnableWindow(TRUE);
    SaveFilters();
	SetModified(TRUE);
	UpdateParentName();
}
void CFilterList :: OnAddbutton ( ) { CFilterEntry * newEntry = new CFilterEntry ; m_NameEdit . GetWindowText ( newEntry -> Name ) ; newEntry -> Name . TrimLeft ( ) ; newEntry -> Name . TrimRight ( ) ; if ( newEntry -> Name . GetLength ( ) == 0 ) { MessageBox ( " " , " " , MB_ICONSTOP | MB_OK ) ; return ; } m_CommandEdit . GetWindowText ( newEntry -> Command ) ; int pos = m_AllFilters . Add ( newEntry ) ; int index = m_SaveList . AddString ( newEntry -> Name ) ; m_SaveList . SetItemData ( index , pos ) ; m_SaveList . SetCurSel ( index ) ; m_ChangeButton . EnableWindow ( TRUE ) ; m_RemoveButton . EnableWindow ( TRUE ) ; SaveFilters ( ) ; SetModified ( TRUE ) ; UpdateParentName ( ) ; }
This callback runs when user press "Add" button.
This callback runs when user press " Add " button .