How do I use new debug functions?

Ask how to do things or if a certain feature is available in the program.
Post Reply
User avatar
pjj
Posts: 1853
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

How do I use new debug functions?

Post by pjj »

I am really thankful for adding new debug functions so swiftly! Sadly, I have no idea how to use them properly.

MainApp.OutputDebugString(strText, value)

This works, however I have no idea what strText should be :? I guess it should be variable, and 2nd parameter is superfluous, or so it seems:

Code: Select all

let str = "Hello, world!";
MainApp.OutputDebugString("str", str2); // output: str
MainApp.OutputDebugString("str"); // error message: not enough actual parameters
MainApp.OutputDebugString(str, "str2"); // output: Hello, world!
Variable str2 isn't declared anywhere. Is it really necessary? How so?

MainApp.OutputDebugObjectString(strText, obj);

Code: Select all

TElMainMenu mainMenu = MainApp.GetMainMenu;
MainApp.OutputDebugObjectString("obj", mainMenu); // error message TElMainMenu has not been registered as a COM class

Code: Select all

let fruits = ["apples", "bananas", "oranges"]
MainApp.OutputDebugObjectString(obj, fruits); // Could not convert of variant (Null) into type (OleStr)
MainApp.OutputDebugObjectString("obj", fruits); // Could not convert of variant (Array Variant) into type (Integer)
:?

I use it as JScript code.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus

User avatar
Rickard Johansson
Site Admin
Posts: 6091
Joined: 19 Jul 2006 14:29

Re: How do I use new debug functions?

Post by Rickard Johansson »

Code: Select all

let str = "Hello, world!";
MainApp.OutputDebugString("My variable str =", str);

Code: Select all

let n = 10;
MainApp.OutputDebugString("My variable n =", n);

Code: Select all

let list = TStringlist.Create;
list.Add("Hello world!");
MainApp.OutputDebugObjectString("My string list contains:", list);
I think the mainMenu is treated as a pointer and not as an object internally. That may not work...

User avatar
pjj
Posts: 1853
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: How do I use new debug functions?

Post by pjj »

Thanks a lot for your prompt response! Sadly

Code: Select all

let str = "Hello, world!";
MainApp.OutputDebugString("My variable str =", str);
doesn't work for me; all I get is "My variable str = ". It works for the integer, though.

As for your third example, I get

Code: Select all

My string list contains: {"Duplicates":0,"Sorted":false,"CaseSensitive":false,"OwnsObjects":false,"Updating":false,"Capacity":4,"CommaText":"\"Hello world!\"","Count":1,"Delimiter":"
which looks like it was terminated in mid-run.
Rickard Johansson wrote:
02 Mar 2021 21:51
I think the mainMenu is treated as a pointer and not as an object internally. That may not work...
And it doesn't, so I'm back to square one, it seems... (Btw. arrays aren't displayed, either.)
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus

Professor Bernd
Posts: 8
Joined: 02 Apr 2021 20:45

Re: How do I use new debug functions?

Post by Professor Bernd »

Hello pjj.

Has this been fixed? Is it now possible to write the content of string variables to the message window?

I did not succeed, neither with example 1, nor with example 3 from Rickard. I got the same results as you.

Post Reply