Jul 20, 2016 at 1:06pm UTC
I tried on C disc and still nothing.
Jul 22, 2016 at 8:40pm UTC
You mean that I should use it in OnClose method?
Jul 23, 2016 at 9:42am UTC
Common practice is to declare TIniFile *IniFile;
in the Form class and create it in the OnCreate method. In OnClose you delete it.
Jul 29, 2016 at 3:26pm UTC
Normally yes, if you have your class declaration there.
Aug 4, 2016 at 8:03pm UTC
IniFile = new TIniFile("C:\\timer.ini" );
I thought you were using a different location ?
Aug 12, 2016 at 4:18pm UTC
That's because you haven't defined the symbol FIniFile . You should probably do that.
Aug 12, 2016 at 6:18pm UTC
Another solution of extracting label-captions is to parse the DFM-File!
Aug 12, 2016 at 9:05pm UTC
@Thomas, we are not in the beginner section...
Aug 13, 2016 at 7:21am UTC
This is my little function which "parses" (indeed it searches for patterns) to find all "Properties.OnEditValueChanged" in a DFM file. Read the file first in MemoIn then call this function. It needs a TMemo* MemoOut in the form.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
void TForm1::Search (std::string& strFileName) {
std::stack<std::string> mystack;
std::string strObject = "object" ;
std::string strInline = "inline" ;
std::string strInherited = "inherited" ;
std::string strProperties = "Properties.OnEditValueChanged" ;
std::string strEnd = "end" ;
std::string strSeparator = "|" ;
std::string strToken;
int iCount = MemoIn->Lines->Text.Length();
for (int idx = 1; idx <= iCount; ++idx) {
char c = MemoIn->Lines->Text[idx];
Application->ProcessMessages();
if (c == ' ' || c == 13 || c == 10) {
if (strToken == strObject ||
strToken == strInline ||
strToken == strInherited ||
strToken == strProperties) {
std::string strRest = strFileName + strSeparator + strToken + strSeparator;
for (++idx; idx <= iCount; ++idx) {
char c = MemoIn->Lines->Text[idx];
if (c == 13 || c == 10)
break ;
strRest += c;
}
if (strToken == strObject ||
strToken == strInline ||
strToken == strInherited)
mystack.push(strRest);
else {
if (mystack.size()) {
std::string s = mystack.top() + strSeparator + strRest;
mystack.pop();
MemoOut->Lines->Add(s.c_str());
}
}
strToken.clear();
}
else if (strToken == strEnd) {
if (mystack.size()) {
std::string s = mystack.top();
mystack.pop();
MemoOut->Lines->Add(s.c_str());
}
}
strToken.clear();
continue ;
}
else if (c == '{' ) {
for (++idx; idx <= iCount; ++idx) {
char c = MemoIn->Lines->Text[idx];
if (c == '}' )
break ;
}
++idx;
continue ;
}
strToken += c;
}
return ;
}
Last edited on Aug 13, 2016 at 7:23am UTC