Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-03

unit Dialogs and showmessage

4 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd

http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/showmessage.html

Source position: dialogs.pp line 510

procedure ShowMessage(
  const aMsg: String
);

there is also an example program:

Program LazMessage;
 Uses Dialogs;
 begin
   ShowMessage ('This is a message from Lazarus')
 end.
This does not compile: project1.lpr(4,16) Error: Identifier not found
"ShowMessage"

Also i cannot find the definition of this procedure anywhere in the unit dialogs and also this file is called dialogs.pas and not dialogs.pp on my system. How would i tell the use clause that i would like to use dialogs.pp instead of dialogs.pas?

I am on linux, using fpc 2.4 and a few days old lazarus snapshot. Does this unit or this function not exist on other platforms than windows? There is no mention of this in the documentation, or is the documentation outdated or am i doing/understanding some completely wrong here?

Reply by email

Andreas Schneider
to Bernd
Bernd wrote 29 lines
http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/showmessage.html Source position: dialogs.pp line 510 procedure ShowMessage( const aMsg: String ); there is also an example program: Program LazMessage; Uses Dialogs; begin ShowMessage ('This is a message from Lazarus') end. This does not compile: project1.lpr(4,16) Error: Identifier not found "ShowMessage" Also i cannot find the definition of this procedure anywhere in the unit dialogs and also this file is called dialogs.pas and not dialogs.pp on my system. How would i tell the use clause that i would like to use dialogs.pp instead of dialogs.pas? I am on linux, using fpc 2.4 and a few days old lazarus snapshot. Does this unit or this function not exist on other platforms than windows? There is no mention of this in the documentation, or is the documentation outdated or am i doing/understanding some completely wrong here?

Your project needs to have LCL as dependency, otherwise unit Dialogs is something completeley different. Also the LCL needs to be initialized, you can't just make such calls. I think it gets initialized by including the unit Interfaces (as first unit).

Generally it's easier to create a full fledged LCL project and not a console project.

Best regards,
Andreas.

Reply by email

Mattias Gaertner
to Bernd: http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/showmessage.html Source position:…
Show quoted text 15 lines
http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/showmessage.html Source position: dialogs.pp line 510 procedure ShowMessage( const aMsg: String ); there is also an example program: Program LazMessage; Uses Dialogs; begin ShowMessage ('This is a message from Lazarus') end.

First of all:
This is not a valid LCL program. You are missing the unit interfaces. And probably you forgot to add the package LCL as dependency in the project inspector.

This does not compile: project1.lpr(4,16) Error: Identifier not found "ShowMessage"

If an identifier is not found you can do:

Right click on the message, in the popup menu click "Search identifier". This will open the "Code Browser". It will search in all units. It will find "ShowMessage" in two units. Expand the node of the unit LCL/Dialogs. Right click on the first procedure and click on "Use unit dialogs in unit unit1".

Also i cannot find the definition of this procedure anywhere in the unit dialogs and also this file is called dialogs.pas and not dialogs.pp on my system. How would i tell the use clause that i would like to use dialogs.pp instead of dialogs.pas?

The extension is irrelevant for the compiler. The important thing is that the LCL must be found (is searched before searching in the default locations).

Show quoted text 5 lines
I am on linux, using fpc 2.4 and a few days old lazarus snapshot. Does this unit or this function not exist on other platforms than windows? There is no mention of this in the documentation, or is the documentation outdated or am i doing/understanding some completely wrong here?

Hint: Not every unit on your disk is automatically available to all projects. You have to tell first the IDE what packages you want to use in your project.

Mattias

Reply by email

Juha Manninen
to Bernd: http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/showmessage.html Source position:…
Show quoted text 21 lines
Source position: dialogs.pp line 510 procedure ShowMessage( const aMsg: String ); there is also an example program: Program LazMessage; Uses Dialogs; begin ShowMessage ('This is a message from Lazarus') end. This does not compile: project1.lpr(4,16) Error: Identifier not found "ShowMessage" Also i cannot find the definition of this procedure anywhere in the unit dialogs and also this file is called dialogs.pas and not dialogs.pp on my system. How would i tell the use clause that i would like to use dialogs.pp instead of dialogs.pas?

The source file suffix is not relevant here.
I think you try to call an LCL function from a command line program. It doesn't have LCL listed as a required package.
You should use ShowMessage only in graphical GUI applications. In command line program you can use writeln instead.

Regards,
Juha Manninen

Reply by email