Link to home
Start Free TrialLog in
Avatar of PeterdeB
PeterdeBFlag for Netherlands

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','ShowSplash', 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.
ASKER CERTIFIED SOLUTION
Avatar of Roadcrash
Roadcrash
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial