![]() |
Delphi-Version: XE7
Eventhandling problem/ahnungslosigkeit
Hallo ;)
Delphi-Quellcode:
Ich habe ein animiertes gif als splashscreen das sobald es einmal durchlaufen ist die mainform laden soll.
procedure TFormSplash.OnLoop(sender:TObject);
begin //splash screen zu ende end; procedure TFormSplash.FormCreate(Sender: TObject); begin //Application.CreateForm(TFormMain, FormMain); (ImageSplash.Picture.Graphic as TGIFImage).Animate := True; (ImageSplash.Picture.Graphic as TGIFImage).OnLoop := OnLoop; end; Ich kenne mich mit eventhandlich in delphi nicht aus, daher bin ich ratlos was daran falsch ist. Kann ich prozeduren so nicht dem event zuweisen? Danke |
AW: Eventhandling problem/ahnungslosigkeit
Das stimmt schon so. Evtl. hast du oben das hier vergessen:
Delphi-Quellcode:
type
TFormSplash = class(TForm) ... private procedure OnLoop(sender:TObject); end; |
AW: Eventhandling problem/ahnungslosigkeit
Zitat:
ABER, auch wenn da Property OnLoop deklariert ist, so wird es intern scheinbar niemals aufgerufen ... da kannst'e also lange warten. :stupid: Bug an Emba melden und TTimer nehmen (du weißt ja, wie lang das GIF ist) |
AW: Eventhandling problem/ahnungslosigkeit
Also für eine simple Splash-Form genügt das hier:
Die Projekt-Datei (nichts Auffälliges dort):
Delphi-Quellcode:
Die MainForm
program dp_184173;
uses Vcl.Forms, Form.MyMainForm in 'Form.MyMainForm.pas' {MyMainForm}, Form.MySplashForm in 'Form.MySplashForm.pas' {MySplashForm}; {$R *.res} begin Application.Initialize; Application.MainFormOnTaskbar := True; Application.CreateForm(TMyMainForm, MyMainForm); Application.Run; end.
Delphi-Quellcode:
Die Splash-Form:
unit Form.MyMainForm;
interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs; type TMyMainForm = class( TForm ) private public procedure AfterConstruction; override; end; var MyMainForm: TMyMainForm; implementation {$R *.dfm} uses Form.MySplashForm; { TMyMainForm } procedure TMyMainForm.AfterConstruction; var LSplash : TMySplashForm; begin inherited; // Die MainForm soll NICHT angezeigt werden Application.ShowMainForm := False; // Eine Splash-Form erzeugen und anzeigen LSplash := TMySplashForm.Create( Application ); LSplash.Show; end; end.
Delphi-Quellcode:
unit Form.MySplashForm;
interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TMySplashForm = class( TForm ) Button1: TButton; procedure Button1Click( Sender: TObject ); private protected procedure DoClose( var Action: TCloseAction ); override; public end; var MySplashForm: TMySplashForm; implementation {$R *.dfm} procedure TMySplashForm.Button1Click( Sender: TObject ); begin Self.Close; end; procedure TMySplashForm.DoClose( var Action: TCloseAction ); begin // Diese Form-Instanz zerstören Action := caFree; // Die MainForm sichtbar machen Application.MainForm.Visible := True; inherited; end; end. |
AW: Eventhandling problem/ahnungslosigkeit
Zitat:
@Sir Rufo: Ja danke, ist bestimmt hilfreich für Leute die nicht wissen wie man eine Splashform erstellt/handled. Aber mein Problem bestand ja nicht darin eine Splashfrm zu erstellen sondern mit dem Eventhandling des events "onloop" von TGIFImage. Aber wie himitsu bereits feststellte: Das event wird intern niemals gecallt, d.h. meine Funktion zum handlen wird auch nie aufgerufen -> Bug. MfG |
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:01 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz