I hope I found the correct forum...
In a small GUI program, when I call sysutils.beep(), then the OS (Linux Ubuntu 18.04) shows a small dialog window to inform me about that sound (my computer has no loudspeaker):
procedure TForm1.Button1Click(Sender: TObject);
begin
sysutils.beep;
end;
This small dialog window appears only, when I call the GUI program from a terminal and
not if I start it within Lazarus (which is no problem). But this small dialog window does
not appear, when I call sysutils.beep() in a small console program (started from a terminal):
{$mode objfpc}{$H+}
uses sysutils;
begin {main}
sysutils.beep;
end.
I want this small dialog window in a console program.
What I found out:sysutils.beep() is defined in <installdir>/fpcsrc/rtl/objpas/sysutils/sysutils.inc as
procedure Beep;
begin
If Assigned(OnBeep) then OnBeep;
end;
// with:
Var OnBeep : TBeephandler = Nil;
and in <installdir>/fpcsrc/rtl/unix/sysutils.pp I found that var 'OnBeep' is initialized with:
Procedure SysBeep;
begin
Write(#7);
Flush(Output);
end;
I replaced my calls for sysutils.beep() with "Write(#7); Flush(Output);" and got the same results as before.
In my GUI program I found out, that sysutils.beep() in TForm1.FormCreate() and earlier does
not work, but it works in TForm1.FormActivate() and later. So what is "changed" between those 2 calls?
Can it be, that var 'Output' is "manipulated" in GUI programs?Version: Lazarus 2.0.10 with FPC 3.2.0
What I want is to get this small dialog window from the OS, when I call sysutils.beep() in a console program. Thanks in advance.