PeterdeB
asked on
How to let my ini file determine whether to show a splash screen?
Hi Wizards!
I want the user to be able to control whether a splashscreen is shown or not. THis shoudl be done by means of a checkbox in the application in conjunction with an inifile. Now this is what I have >
//code
private
FShowSplash: Boolean;
property ShowSplash: Boolean read FShowSplash write FShowSplash;
......
procedure TForm1.FormCreate(Sender: TObject);
var
Ini: TIniFile;
begin
Ini := TIniFile.Create( ChangeFileExt( Application.ExeName, '.INI' ) );
try if
Ini.ReadBool('GUI','ShowSp lash', False) then
ShowSplash := False else
ShowSplash := True;
finally
TIniFile.Free;
end;
end;
.....
procedure TForm1.FormShow(Sender: TObject);
begin
if ShowSplash then
Sleep(1000);
fSplash.Release;
end;
// end of code
Delphi's complaint:[Error] Main.pas(61): This form of method call only allowed for class methods. Now my guess would be that I'm doing something terribly wrong so my question is what am I doing wrong here?
Any other approaches are welcome as well ofcourse, as long as teh user is able to control whether the splash screen pops up or not.
Regards Paul :)
Ps thanks in advance and please comment as much as possible.
I want the user to be able to control whether a splashscreen is shown or not. THis shoudl be done by means of a checkbox in the application in conjunction with an inifile. Now this is what I have >
//code
private
FShowSplash: Boolean;
property ShowSplash: Boolean read FShowSplash write FShowSplash;
......
procedure TForm1.FormCreate(Sender: TObject);
var
Ini: TIniFile;
begin
Ini := TIniFile.Create( ChangeFileExt( Application.ExeName, '.INI' ) );
try if
Ini.ReadBool('GUI','ShowSp
ShowSplash := False else
ShowSplash := True;
finally
TIniFile.Free;
end;
end;
.....
procedure TForm1.FormShow(Sender: TObject);
begin
if ShowSplash then
Sleep(1000);
fSplash.Release;
end;
// end of code
Delphi's complaint:[Error] Main.pas(61): This form of method call only allowed for class methods. Now my guess would be that I'm doing something terribly wrong so my question is what am I doing wrong here?
Any other approaches are welcome as well ofcourse, as long as teh user is able to control whether the splash screen pops up or not.
Regards Paul :)
Ps thanks in advance and please comment as much as possible.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.