Eduardo Jauch
2007-06-30 17:19:30 UTC
Hello!
I have a project with many versions. When I need to modify my program, I
copy the directory of it with a new name and begin to work in this "new
project" (any tips to improve this I'll apreciate).
Now, something happens.
I use a TOpenDialog to open one or more files to use by my program.
Because the order in wich they are open is important, I use a struct to
store all the data of each file opened and put this struct in a TList.
So, the data on the first file open is put on the first position of the
TList, the second on the secont and go on.
On the last 14 versions of the program, this work perfectly.
But in my new version, when I click on the button that open the
TOpenDialog, all work fine. I can pick a file with no problem. The
problem occour when I click the button for the second time. The program
open the dialog, and before I can select a file, the program CLOSES!!!!
I think that some type of error on the project could do that, so, I
created a new project, put my files on it (only the source code, the
obj, tds, I erased).
But the same problem.
I don't think that is the code, because i don't change it and the others
versions work correctly yet, but here is the code that opens the Dialog:
void __fastcall TForm1::LoadApplicantClick(TObject *Sender)
{
TTime timeNow;
if(OpenDialog->Execute())
{
Memo->Lines->Add(timeNow.CurrentTime().TimeString() + "
Armazenando dados da família...");
for(int i = 0; i < OpenDialog->Files->Count; i++)
{
Memo->Lines->Add(timeNow.CurrentTime().TimeString() + " Lendo
dados do arquivo: " + OpenDialog->Files->Strings[i] + "...");
ApplicantList_.LoadFile(OpenDialog->Files->Strings[i]);
Memo->Lines->Strings[Memo->Lines->Count - 1] =
Memo->Lines->Strings[Memo->Lines->Count - 1] + " (OK)";
}
Memo->Lines->Add(timeNow.CurrentTime().TimeString() + " Dados da
família armazenados.");
Memo->Lines->Add("");
}
}
Memo -> TMemo object
OpenDialog -> TOpenDialog object
ApplicantList_ -> My object that open the file and store the data in a
TList on it.
Like you see, there's nothing wrong with the code. And because when the
OpenDialog is open, he "freeze" the program until I click the open or
cancel button, I can't see how could be my pcode.
I will try to reinstall the BCB (my version is the 6 with sp4)...
Any other tip's are welcome!
Thanks!!!
I have a project with many versions. When I need to modify my program, I
copy the directory of it with a new name and begin to work in this "new
project" (any tips to improve this I'll apreciate).
Now, something happens.
I use a TOpenDialog to open one or more files to use by my program.
Because the order in wich they are open is important, I use a struct to
store all the data of each file opened and put this struct in a TList.
So, the data on the first file open is put on the first position of the
TList, the second on the secont and go on.
On the last 14 versions of the program, this work perfectly.
But in my new version, when I click on the button that open the
TOpenDialog, all work fine. I can pick a file with no problem. The
problem occour when I click the button for the second time. The program
open the dialog, and before I can select a file, the program CLOSES!!!!
I think that some type of error on the project could do that, so, I
created a new project, put my files on it (only the source code, the
obj, tds, I erased).
But the same problem.
I don't think that is the code, because i don't change it and the others
versions work correctly yet, but here is the code that opens the Dialog:
void __fastcall TForm1::LoadApplicantClick(TObject *Sender)
{
TTime timeNow;
if(OpenDialog->Execute())
{
Memo->Lines->Add(timeNow.CurrentTime().TimeString() + "
Armazenando dados da família...");
for(int i = 0; i < OpenDialog->Files->Count; i++)
{
Memo->Lines->Add(timeNow.CurrentTime().TimeString() + " Lendo
dados do arquivo: " + OpenDialog->Files->Strings[i] + "...");
ApplicantList_.LoadFile(OpenDialog->Files->Strings[i]);
Memo->Lines->Strings[Memo->Lines->Count - 1] =
Memo->Lines->Strings[Memo->Lines->Count - 1] + " (OK)";
}
Memo->Lines->Add(timeNow.CurrentTime().TimeString() + " Dados da
família armazenados.");
Memo->Lines->Add("");
}
}
Memo -> TMemo object
OpenDialog -> TOpenDialog object
ApplicantList_ -> My object that open the file and store the data in a
TList on it.
Like you see, there's nothing wrong with the code. And because when the
OpenDialog is open, he "freeze" the program until I click the open or
cancel button, I can't see how could be my pcode.
I will try to reinstall the BCB (my version is the 6 with sp4)...
Any other tip's are welcome!
Thanks!!!