[Lazarus] unit Dialogs and showmessage

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Mar 31 21:02:16 CEST 2010


On Wed, 31 Mar 2010 19:06:29 +0200
Bernd <prof7bit at googlemail.com> wrote:

> 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).


> 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




More information about the Lazarus mailing list