- This topic has 1 reply, 1 voice, and was last updated 11 years, 4 months ago by Marvie.
-
AuthorPosts
-
June 29, 2013 at 11:31 pm #35770MarvieParticipant
I'm somewhat confused on this. JUST DOES NOT want to work in this project.
Problem: programmatically setting root of TsDirectoryEdit upon program startup.
when my application starts up it first reads in variables stored in an .ini file, then sets the TsDirectoryEdit control on the form to reflect what was read. The following is the code used…
Code:procedure InitVariables;
var SettingsFile: TIniFile;
begin
SettingsFile:= TIniFile.Create(ExtractFilePath(ParamStr(0)+'settings.ini'));with SettingsFile Do
begin
MainForm.WatchFolderLoc.Root:= ReadString('Settings','WatchFolderLoc','C:');
MainForm.ArchiveFolderLoc.Root:= ReadString('Settings','ArchiveFolderLoc','C:');
end;
end;WatchFolderLoc & ArchiveFolderLoc are the TsDirectoryEdit controls
When I bring up the options form, both DirectoryEdits are empty, nothing displayed in the text edit box.
I've tried both the TsDirectoryEdit.Text & TsDirectoryEdit.InitialDir property. And nothing.
I've changed DirectInput from false to true, and still nothing.
I've cleaned out any and all project .DCU files, and deleted the original .ini file to recreate, and still nothing
When the directory edits are clicked on, it brings up desktop, instead of the location saved in the ini file.
I have directly specified a location instead of using ReadString method from TIniFile object, and yet still nothing, such as MainForm.WatchFolderLoc.Text:= 'C:TestFolder';
and still nothing. The directory edit won't update with the new info, or even display it.
Any guesses what I'm doing wrong?
Thanks for any help.
[oops I probably should have mentioned this is AlphaSkins ver 8.40 ]
[ problem resolved – see below post ]
June 30, 2013 at 12:30 am #50622MarvieParticipantLOL NEVERMIND!!
Error on my part (two actually).
I forgot ExtractFilePath function also tacks on the backslash character, i.e the ' ' char.
Sooo the code for the string was translating to C:…some folder…\settings.ini
instead of C:Some foldersettings.ini
The double backslash was screwing it up.
plus I realized I didn't release the IniFile object with 'Free'
Although that doesn't affect the reading, just memory issue.
problem solved.
< homer simpson says...> DOH !!!
-
AuthorPosts
- You must be logged in to reply to this topic.