Recent

Author Topic: [SOLVED] Which RTL Unit do I use to get access to the ShowMessage function?  (Read 715 times)

tfurnivall

  • New Member
  • *
  • Posts: 49
Which RTL Unit do I have to use to get access to the ShowMessage function?
« Last Edit: June 18, 2025, 10:25:35 pm by tfurnivall »

cdbc

  • Hero Member
  • *****
  • Posts: 2249
    • http://www.cdbc.dk
Hi
'Dialogs'
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 3.6 up until Jan 2024 from then on it's both above &: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 4.99

Warfley

  • Hero Member
  • *****
  • Posts: 1930
None, Showmessage is not part of the RTL, it is part of the LCL, which means you need to make sure you're project is a Lazarus project with the LCL included and a widgetset setup that can do ShowMessage.

If you have that, than you can include the Dialogs unit from the LCL as cdbc said

d2010

  • Full Member
  • ***
  • Posts: 181
Which RTL Unit do I have to use to get access to the ShowMessage function?
Using Dialogs, is very good, but strange think, when You develop or
other project without Forms,MainMenu(e.g. ConsoleApp}
Code: [Select]
Function DShowMessage(const kTitleRow,PolicyDef:string): integer;
Var dwg:integer;
Begin
     dwg:=$00000030 Or $0000001 Or $00040000;
     Result := MessageBoxA(Application_Handle,pchar(PolicyDef),pchar(kTitleRow),dwg);
End;
{--}
Function YShowMessage(const vla_AngleToString: String;handent:THandle): boolean;
      Begin
        if (handent=0) then handent:=GetDesktopWindow else
        if (handent=1)and(application_handle<>0) then handent:=application_handle;
        Result := (idyes=MessageBox(handent, pchar(vla_AngleToString),'@pidone.rtf[1]', dcl_yesno));
      End;

MarkMLl

  • Hero Member
  • *****
  • Posts: 8453
Which RTL Unit do I have to use to get access to the ShowMessage function?

Note that it's not in FPC's RTL but in Lazarus's LCL: they're separate projects.

When we were discussing storage earlier I showed you where to find the root documentation for the current version of FPC. If you're actually using Lazarus you might find https://lazarus-ccr.sourceforge.io/docs/ since it's for the current LCL and the version of FPC that accompanies it which might lag slightly, follow the LCL link and you'll find an index link at the top-left of the page. That does include ShowMessage (I've just checked) and tells you the unit it's in.

Contributed in the spirit of "Teach a man to fish..." :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

tfurnivall

  • New Member
  • *
  • Posts: 49
Thanks, all!

I've been out of town, and forgot to set the NotifyMe option.

Marked [SOLVED]

Tony

Thaddy

  • Hero Member
  • *****
  • Posts: 17396
  • Ceterum censeo Trump esse delendam
There are two very important macro's for this:
Code: Pascal  [Select][+][-]
  1. {$macro on}
  2. {$define ShowMessage := Writeln} // for me
  3. {$define Writeln := ShowMessage} // for GUI apps
Probably won't work at the same time. %) %)
« Last Edit: June 19, 2025, 08:41:55 am by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

 

TinyPortal © 2005-2018