//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "notatnik.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
ansistring nazwapliku!="";
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Otwrz1Click(TObject *Sender)
{
if(OpenDialog1->Execute())
{
try{
tresc->Lines->LoadFromFile(OpenDialog1->FileName);
nazwapliku=opendialog1->FileName;
}
catch(...){
ShowMessage("nie znaleziono pliku");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Zapiszjako1Click(TObject *Sender)
{
if(SaveDialog1->Execute())
{
try{
tresc->Lines->SaveToFile(SaveDialog1->FileName);
nazwapliku=savedialog1->FileName;
}
catch(...){
ShowMessage("Błąd");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Zapisz1Click(TObject *Sender)
{
if(nazwapliku!=""){
tresc->Lines->SaveToFile(nazwapliku);
}
else{form1->Zapiszjako1Click(MainMenu1)}
}
//---------------------------------------------------------------------------