Re: [fpc-pascal] Program without window but messages

2012-04-25 Thread Sven Barth
On 24.04.2012 18:25, Jürgen Hestermann wrote: I wanted to write a program that has no window but may show messages to the user. I have lots of such programs written with Virtual Pascal but I am struggling to do the same with Free Pascal/Lazarus. A simple test program would look like this: -

Re: [fpc-pascal] Program without window but messages

2012-04-25 Thread JC Chu
As leledumbo has pointed out, you need to call Application.Initialize() before using LCL features. The code for TApplication.Initialize() shows that it initializes the currently active widget set, which is maintained by the Interfaces unit. ShowMessage() relies ultimately upon TWidgetSet.PromptUs

Re: [fpc-pascal] Program without window but messages

2012-04-25 Thread Jürgen Hestermann
Howard Page-Clark schrieb: > A GUI program requires a "main window" since that is the avenue for user interaction. > You can hide that window (not "ignore" it) as in the following program, which compiles > and runs. However, I can't myself see the use of such truncated GUI functionality. > Once

Re: [fpc-pascal] Program without window but messages

2012-04-25 Thread Jürgen Hestermann
JC Chu schrieb: > Try this. > program Test; > {$MODE DELPHI} > {$APPTYPE GUI} > uses > {$IF Defined(UNIX) and Defined(UseCThreads)}cthreads,{$ENDIF} > Interfaces, Forms, Dialogs; > > begin > Application.Initialize; > ShowMessage('Test'); > end. Yes, this works

Re: [fpc-pascal] Program without window but messages

2012-04-25 Thread Jürgen Hestermann
Sven Barth schrieb: >> When I create a new project and select to create an "Application", >> copy the above into the main program (ignoring Unit1.pas) and run >> the program I get an exception "Fensterklasse nicht gefunden" (in >> german, although I setup Lazarus in english!) > > This specific exc

Re: [fpc-pascal] Program without window but messages

2012-04-25 Thread Sven Barth
Am 24.04.2012 18:25, schrieb Jürgen Hestermann: I wanted to write a program that has no window but may show messages to the user. I have lots of such programs written with Virtual Pascal but I am struggling to do the same with Free Pascal/Lazarus. A simple test program would look like this: ---

Re: [fpc-pascal] Program without window but messages

2012-04-24 Thread Howard Page-Clark
On 24/4/12 5:25, Jürgen Hestermann wrote: I wanted to write a program that has no window but may show messages to the user. I have lots of such programs written with Virtual Pascal but I am struggling to do the same with Free Pascal/Lazarus. A simple test program would look like this: -

[fpc-pascal] Program without window but messages

2012-04-24 Thread Jürgen Hestermann
I wanted to write a program that has no window but may show messages to the user. I have lots of such programs written with Virtual Pascal but I am struggling to do the same with Free Pascal/Lazarus. A simple test program would look like this: program Test; {$m