Recent

Author Topic: outrput to the "messages" window  (Read 8407 times)

adamski

  • New Member
  • *
  • Posts: 16
outrput to the "messages" window
« on: October 09, 2009, 01:40:42 am »
Hi all;

Is there any way to write to the "messages" dialogue?
I.e. I could use this when running unit tests, and the additional output to the message dialogue would be very handy if a test fails.

( Note the "messages dialogue" being the dialogue containing the compiliation messages )

Many thanks
Marc


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12202
  • Debugger - SynEdit - and more
    • wiki
Re: outrput to the "messages" window
« Reply #1 on: October 09, 2009, 02:18:34 am »
No your own app can not write to the lazarus message app. As all apps are designed to run equaly without the ide => in which case there is no msg window.

However, there is a way for easy additional output. Compile you app as console app (assuming you are on windows) it in the compiler options, linking tab: uncheck the "win 32 app -WG" checkbox)

Then you have a console window while your app runs (on linux, just start it from a terminal).
You can write to that console via debugln from unit LCLProc. There is also dbgs() to format selected structures, and values.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: outrput to the "messages" window
« Reply #2 on: October 09, 2009, 05:29:51 am »
Is there any way to write to the "messages" dialogue?
I.e. I could use this when running unit tests, and the additional output to the message dialogue would be very handy if a test fails.

There's probably a couple ways to do this. One would be to add a generic external tool (specify your executable with one of the macros) that runs your test app. Just  compile it, then select the external tool to run it. Output to the console by the external tool should show up in the messages window. See this project for examples of external tools that do that. You might need to play around with "Scan options" to see what works best. Tools | Configure external tools.

http://web.fastermac.net/~MacPgmr/PhpTk/PhpTkStatus.html#Lazarus

Console apps run before or after compiling can also write to the message window. See Project | Compiler Options, Compilation tab.

Thanks.

-Phil

 

TinyPortal © 2005-2018