procedure TfrmCD.btnOKClick(Sender: TObject);
var
cdobj: TCD;
newsub,
newcd : IXMLDOMNode;
begin
cdobj := TCD.Create;
cdobj.CDTitel := edtTitel.Text;
cdobj.CDInterpret := edtInterpret.Text;
cdobj.CDGenre := edtGenre.Text;
cdobj.Save;
{in XML-Datei schreiben, anfang}
newcd := frmMain.xmlDoc.createElement('
cd');
newsub := frmMain.xmlDoc.createElement('
cdid');
newsub.text := IntToStr(frmMain.strgrdCDListe.RowCount);
newcd.appendChild(newsub);
newsub := frmMain.xmlDoc.createElement('
cdtitel');
newsub.text := cdobj.CDTitel;
newcd.appendChild(newsub);
newsub := frmMain.xmlDoc.createElement('
interpret');
newsub.text := cdobj.CDInterpret;
newcd.appendChild(newsub);
newsub := frmMain.xmlDoc.createElement('
genre');
newsub.text := cdobj.CDGenre;
newcd.appendChild(newsub);
frmMain.xmlDoc.documentElement.appendChild(newcd);
frmMain.xmlDoc.save(frmMain.xmlfile);
{in XML-Datei schreiben, ende}
{in TStringGrid zu Ansicht darstellen}
with frmMain.strgrdCDListe
do begin
begin
RowCount := frmMain.strgrdCDListe.RowCount+1;
Cells[0,frmMain.strgrdCDListe.RowCount-1]:=IntToStr(frmMain.strgrdCDListe.RowCount-1);
Cells[1,frmMain.strgrdCDListe.RowCount-1] := cdobj.CDTitel;
Cells[2,frmMain.strgrdCDListe.RowCount-1] := cdobj.CDInterpret;
Cells[3,frmMain.strgrdCDListe.RowCount-1] := cdobj.CDGenre;
RowHeights[frmMain.strgrdCDListe.RowCount-1] := rowxheights;
end;
end;
cdobj.Free;
Close;
end;