Recent

Author Topic: how to close all forms Lazarus?  (Read 8332 times)

Neprofi

  • Full Member
  • ***
  • Posts: 174
how to close all forms Lazarus?
« on: June 19, 2015, 04:15:55 pm »
People like to close all forms Lazarus, when you click on the output it must withdraw from the program and immediately play a sound.
« Last Edit: June 19, 2015, 04:19:43 pm by Neprofi »

Neprofi

  • Full Member
  • ***
  • Posts: 174
Re: closing all at once in the form of Lazarus?
« Reply #1 on: June 19, 2015, 04:18:06 pm »
I know a way out for example form1. close.

but I have a lot of forms and I have a full output and not just close one form, and that would be lost in the sound output.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8831
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: how to close all forms Lazarus?
« Reply #2 on: June 19, 2015, 06:10:53 pm »
Close the main form, and play sound at that's form's OnClose event.

Neprofi

  • Full Member
  • ***
  • Posts: 174
Re: how to close all forms Lazarus?
« Reply #3 on: June 19, 2015, 07:30:14 pm »
what the hell

mirce.vladimirov

  • Sr. Member
  • ****
  • Posts: 266
Re: how to close all forms Lazarus?
« Reply #4 on: June 19, 2015, 10:51:31 pm »
just do :

Code: [Select]
application.Terminate;
at any point in your code.

Neprofi

  • Full Member
  • ***
  • Posts: 174
Re: how to close all forms Lazarus?
« Reply #5 on: June 20, 2015, 01:02:56 pm »
but as I write this and connect the sound I'm just throwing out a program and the sound does not play

JanRoza

  • Hero Member
  • *****
  • Posts: 731
    • http://www.silentwings.nl
Re: how to close all forms Lazarus?
« Reply #6 on: June 20, 2015, 02:37:49 pm »
Maybe you should show us your project code, so we could see what you do and how you try do it?
OS: Windows 11 / Linux Mint 22.2
       Lazarus 4.2 RC FPC 3.2.2
       CodeTyphon 8.80 FPC 3.3.1

Neprofi

  • Full Member
  • ***
  • Posts: 174
Re: how to close all forms Lazarus?
« Reply #7 on: June 20, 2015, 03:47:20 pm »
so I try to close the program and what would have played the song.

procedure TForm2.MenuItem9Click(Sender: TObject);
begin

if stream<>0 then        //если песня=0 то очищаем стреам
Bass_StreamFree(stream); //если песня=0 то очищаем стреам
stream:= Bass_streamcreatefile(false, PChar('sound\Sound_engl\pronunciation_en_goodbye.mp3'),0,0,0);
Bass_channelplay(stream,false);

Close; //закрытие формы одной
Application.Terminate; //полный выход с программы
end;   

JanRoza

  • Hero Member
  • *****
  • Posts: 731
    • http://www.silentwings.nl
Re: how to close all forms Lazarus?
« Reply #8 on: June 20, 2015, 05:53:39 pm »
Could it not be that the application.terminate prevents the song from playing, maybe you must let your application wait for the song to play and when the song is finished terminate the application.
OS: Windows 11 / Linux Mint 22.2
       Lazarus 4.2 RC FPC 3.2.2
       CodeTyphon 8.80 FPC 3.3.1

Neprofi

  • Full Member
  • ***
  • Posts: 174
Re: how to close all forms Lazarus?
« Reply #9 on: June 20, 2015, 08:05:23 pm »
and how to do it like using a timer can example small? please)

 

TinyPortal © 2005-2018