Recent

Author Topic: Show Intro while Application Inizializing  (Read 1987 times)

Weitentaaal

  • Hero Member
  • *****
  • Posts: 516
  • Weitental is a very beautiful garbage depot.
Show Intro while Application Inizializing
« on: March 25, 2021, 02:23:07 pm »
Hello Guys :)

So i tryed out a Lot but didn't find anything to work with.
I Wanted Show a Logo on Screen while MainForm is in "OnCreate" Event.
It Should show a Picture wich gets Displayed until Form is Ready to use.

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Show Intro while Application Inizializing
« Reply #1 on: March 25, 2021, 02:30:16 pm »
"Splash screen" is the term you are looking for, search for it and you will see examples.

Josh

  • Hero Member
  • *****
  • Posts: 1274
Re: Show Intro while Application Inizializing
« Reply #2 on: March 25, 2021, 02:41:19 pm »
Hi

If its all to be on the same form,

the order of the events are

create,show,activate.

have a look at this atricle on delphi.
https://www.thoughtco.com/life-cycle-of-a-delphi-form-1058011

I would not add too much to the Oncreate event, just the basics.
use the onshow and activate events; and havea variable that only allow it to run code once; as thiese events can be fired at other times.

maybe something like this.
global vars
formshowcodecomplete:boolean=false;
formactivatecodecomplete:boolean=false;

The onshow event you could add here something like.
begin
  if formshowcodecomplete=false then
  begin
      formshowcodecomplete:=true;
      // do code here to run only the minimum required to allow form to be dislayed.
      mysplashpanel.visible:=true;
      .. any important stuff;
  end;
end;

in the onactivate event.
begin
  if formactivatecodecomplete=false then
  begin
    formactivatecodecomplete:=true;
     // do code here to run only once.
    ... do all the initializing stuff now, the stuff that takes time.
    // depending on how much you could also update a visible progress throughout this routine.
     mysplashpanel.visible:=false;
  end;
end;
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Handoko

  • Hero Member
  • *****
  • Posts: 5153
  • My goal: build my own game engine using Lazarus
Re: Show Intro while Application Inizializing
« Reply #3 on: March 25, 2021, 03:09:50 pm »

alaa123456789

  • Sr. Member
  • ****
  • Posts: 260
  • Try your Best to learn & help others
    • youtube:
Re: Show Intro while Application Inizializing
« Reply #4 on: March 25, 2021, 05:46:03 pm »
i have found very nice library made with c , and post it on this forum but experts they said it is not important now , so if someone have experience to port it to lazarus it could be useful for many here

https://forum.lazarus.freepascal.org/index.php/topic,53295.msg394097.html#msg394097

thanks

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Show Intro while Application Inizializing
« Reply #5 on: March 25, 2021, 05:51:22 pm »
but experts they said it is not important now

Huh? where did they say that?

Handoko

  • Hero Member
  • *****
  • Posts: 5153
  • My goal: build my own game engine using Lazarus
Re: Show Intro while Application Inizializing
« Reply #6 on: March 25, 2021, 05:52:40 pm »
That library is interesting. Unfortunately I'm not familiar with vector image loading, JSON and C. Not an easy task, finding someone has all the skills is not easy too.

ps
I believe, not a trivial task means not simple/easy.
« Last Edit: March 25, 2021, 06:07:57 pm by Handoko »

alaa123456789

  • Sr. Member
  • ****
  • Posts: 260
  • Try your Best to learn & help others
    • youtube:
Re: Show Intro while Application Inizializing
« Reply #7 on: March 25, 2021, 06:03:27 pm »
Quote

Huh? where did they say that?
in same topic, i think many look for something made the application attractive.
nothing compulsory 
thanks
« Last Edit: March 25, 2021, 06:23:32 pm by alaa123456789 »

furious programming

  • Hero Member
  • *****
  • Posts: 858
Re: Show Intro while Application Inizializing
« Reply #8 on: March 26, 2021, 10:58:40 pm »
Some time ago I was making a splash screen for my software. Opening the program required a dozen or so seconds due to the large number of graphics being loaded into the memory. The user must know that the program is starting — he cannot think about what is happening, that the program window does not show, even though the program is running.

I Wanted Show a Logo on Screen while MainForm is in "OnCreate" Event.
It Should show a Picture wich gets Displayed until Form is Ready to use.

It's not done that way. The splash window should be created, displayed on the screen, and destroyed in a manner unrelated to the main program window. Typically, this is done so that the entire splash window process is controlled in the main project file. The splash window is created and displayed on the screen (and blocked), then the data from files is loaded into memory (configuration, images, etc.) and the main window is created. Finally, it destroys the splash and goes to the Application.Run method, which shows the main program window on the screen.

However, the worst thing you can do is throw logic into the main form events. The window should not have any connection with the data and the loading/saving process. If you do this, it will be difficult to do anything.
« Last Edit: March 26, 2021, 11:00:24 pm by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

Weitentaaal

  • Hero Member
  • *****
  • Posts: 516
  • Weitental is a very beautiful garbage depot.
Re: Show Intro while Application Inizializing
« Reply #9 on: March 29, 2021, 01:46:28 pm »
Thanks Guys... there is definitely something i can use :)

 

TinyPortal © 2005-2018