Delphi-PRAXiS
Seite 8 von 10   « Erste     678 910      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Tutorials und Kurse (https://www.delphipraxis.net/36-tutorials-und-kurse/)
-   -   Delphi Tutorial: Splash Screens (https://www.delphipraxis.net/8637-tutorial-splash-screens.html)

xZise 8. Jul 2006 19:06

Re: Tutorial: Splash Screens
 
Seltsam...

Ich habe folgenden Code:
Delphi-Quellcode:
begin
  FSplash := TFSplash.Create(Application);
  try
    FSplash.Show;
    FSplash.Refresh;
    Application.Initialize;
    Application.Title := 'TrackMania IPC';
    Application.CreateForm(TFForm, FForm);
    Application.CreateForm(TForm1, Form1);
  finally
    FSplash.InitializationDone := True;
  end;
  Application.Run;
  FForm.Visible := false;
end.
Splash:
Delphi-Quellcode:
procedure TFSplash.Show;
var i : Integer;
begin
  inherited;
  for i := 0 to 255 do begin
    AlphaBlendValue := i;
    Application.ProcessMessages;
    Sleep(2);
  end;


end;

procedure TFSplash.FormClose(Sender: TObject; var Action: TCloseAction);
var i : Integer;
begin
  for i := 255 downto 0 do begin
    AlphaBlendValue := i;
    Application.ProcessMessages;
    Sleep(2);
  end;
  Action := caFree;
  UIPC.FForm.Enabled := true;
  FSplash := nil;
end;

procedure TFSplash.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  CanClose := (not Timer.Enabled) and FInitializationDone;
end;

procedure TFSplash.SetInitializationDone(const Value: Boolean);
begin
  FInitializationDone := Value;
  Close;
end;

procedure TFSplash.TimerTimer(Sender: TObject);
begin
  Timer.Enabled := False;
  Close;
end;

end.
Ich habe außer dort beim Fade KEIN Sleep.

moelski 17. Okt 2006 10:03

Re: Tutorial: Splash Screens
 
Moin Jungs !

Wollte nur mal eben sagen ...
Vielen Dank für diesen Fred! Hat mich sehr geholft :hello:

:witch:

Svenkan 2. Mai 2007 14:47

Re: Tutorial: Splash Screens
 
Ach sorry!
Vergesst den Post!
Hab übersehn, dass der Splash noch im Hintergrund offen ist!
Kann man das nicht so ändern, dass das Main-Window hinter dem Splash erscheint?

sakura 2. Mai 2007 14:51

Re: Tutorial: Splash Screens
 
Zitat:

Zitat von Svenkan
Kann man das nicht so ändern, dass das Main-Window hinter dem Splash erscheint?

Du musst im Splash den FormStyle auf fsStayOnTop (o.ä.) setzen.

...:cat:...

Matze 2. Mai 2007 14:53

Re: Tutorial: Splash Screens
 
Zitat:

Zitat von Svenkan
Kann man das nicht so ändern, dass das Main-Window hinter dem Splash erscheint?

Stelle einfach FormStyle auf fsStayOnTop, doch das steht hier im Thema irgendwo bereits.

Edit: Da war ich wohl zu langsam ...

Svenkan 2. Mai 2007 14:55

Re: Tutorial: Splash Screens
 
Dankeschön!
Jetzt kommt mir nur grad eins etwas seltsam vor....
Ich kann den SplashScreen nicht schließen. oO
Weder über das 'X', noch über nen Close-Button. oO
Es passiert einfach nix, wenn ich draufklicke...
Und autom. tut sich auch nix.
Der OnClose-Befehl wird ausgeführt, hab ich grad mal gemerkt.
Es wird einfach nix geclosed.

Hier mal noch der Code des Splash-Forms:

Delphi-Quellcode:
unit Unit4;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, jpeg;

type
  TSplash = class(TForm)
    Timer1: TTimer;
    Image1: TImage;
    Label1: TLabel;
    Button1: TButton;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button1Click(Sender: TObject);

  private
    { Private declarations } 
    FInitializationDone: Boolean;
    procedure SetInitializationDone(const Value: Boolean);
  public
    { Public declarations } 
    property InitializationDone: Boolean read FInitializationDone write SetInitializationDone;
  end;


var
  Splash: TSplash;

implementation

uses Unit1;

{$R *.dfm}

procedure TSplash.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  close;
end;

procedure TSplash.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
 CanClose := (not Timer1.Enabled) and FInitializationDone;
end;

procedure TSplash.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
  Splash := nil;
  Form1.Enabled := True;
end;

procedure TSplash.SetInitializationDone(const Value: Boolean);
begin
  FInitializationDone := Value;
  close;
end;

procedure TSplash.Button1Click(Sender: TObject);
begin
close;
end;

end.

sakura 2. Mai 2007 15:18

Re: Tutorial: Splash Screens
 
Du hast den Code gezeigt, welcher den Splash-Screen automatisch schließt (wenn das Hauptformular die "fertig"-Meldung gesandt hat) - lade Dir alle Beispiele herunter, dann siehst Du die verschiedenen Möglichkeiten.

...:cat:...

Die Muhkuh 2. Mai 2007 15:19

Re: Tutorial: Splash Screens
 
Hi,

kann es vielleicht auch sein, dass Du den Code in der Projektdatei vergessen hast?

Svenkan 2. Mai 2007 15:33

Re: Tutorial: Splash Screens
 
@ Die Muhkuh: Jap, ist auch alles drin.

Delphi-Quellcode:
begin
  Splash := TSplash.Create(Application);
  try
    Splash.Show;
    Splash.Refresh;
    Application.Initialize;
    Application.Title := 'SPlan';
    Application.CreateForm(TForm1, Form1);
    Application.CreateForm(TFaecherBox, FaecherBox);
    Application.CreateForm(TSettings_Standard, Settings_Standard);
    Application.CreateForm(TAboutBox, AboutBox);
    Application.CreateForm(THTMLFarben, HTMLFarben);
    Application.CreateForm(TSettings_FTP, Settings_FTP);
    Application.CreateForm(TSchullogo, Schullogo);
    Application.CreateForm(TeMail, eMail);
    Application.CreateForm(TReadme, Readme);
    Application.CreateForm(TSplash, Splash);
    finally
     Splash.InitializationDone := True;
  end;
  Application.Run;
@ sakura: Das komische ist ja, dass ich keinen Unterschied in der Hinsicht finden kann. Entweder bin ich total blind, oder es kann sich nu um ne Kleinigkeit handeln...

Die Muhkuh 2. Mai 2007 15:34

Re: Tutorial: Splash Screens
 
Was hat der Timer für ein Intervall?


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:02 Uhr.
Seite 8 von 10   « Erste     678 910      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz