Page 1 of 1

Debug Output Text color

Posted: Wed Feb 04, 2026 2:45 pm
by tatanas
Hi,

I would like to know if there is a IDE-Tool somewhere that can set a front/back color to the text added to the EditorGadget of the Debug Output window ?
I search a bit on the Purebasic github. I found some files like DebugOutput.pb and DebuggerCommon.pb where part of the interactions with this window is declared but I don't know how to change the behaviour of "Debug" keyword/macro or how to add a new macro like "DebugTextColor" before calling "Debug" to change the color of debugged text.

Re: Debug Output Text color

Posted: Wed Feb 04, 2026 6:45 pm
by Michael Vogel
Nice idea :shock:
I was dreaming to memorize the source code line number of each debug text - this would allow to show the code by hovering over the debug window or to jump directly to the line by double clicking. But: changing the code within the editor while the debug window is shown would need to update these values permanently.

Re: Debug Output Text color

Posted: Thu Feb 05, 2026 10:34 am
by tatanas
Your idea is great too !
About my question, is this possible with an IDE-Tool or should it be included natively in PB ?

Re: Debug Output Text color

Posted: Thu Feb 05, 2026 4:25 pm
by Axolotl
@tatanas:
I'm not sure I fully understand what you want to do.
I can share some thoughts about the windows implementation.
If you want change the color of lines, words or sections and not the entire control you could use the richtext feature of the EditorGadget.
The problem here is, that this textmode needs to activated first. see #EM_SETTEXTMODE with #TM_RICHTEXT, or similar. Default is #TM_PLAINTEXT now. This Sendmessage_() must be the first after creation. At least the Control must be empty. This was changed to the current textmode because of some error reports.
Keep in mind that the debug output can also set to shown in the error-log-control (not sure what control that is).

To make a long story short: I guess it is pretty tricky (if possible) to change this with an IDE-Tool and for the internal implementation it has to be multi-platform.....
Or maybe I'm completely wrong.

Re: Debug Output Text color

Posted: Fri Feb 06, 2026 8:10 am
by Kwai chang caine
Michael Vogel wrote: Wed Feb 04, 2026 6:45 pm I was dreaming to memorize the source code line number of each debug text
Hello nice Duck :wink:
I have not really understand your dream :oops:
You want to say, if i write in the IDE, in "MyCode.pb" file

Code: Select all

122 - a$ = "I love" 
123 - Debug a$ + " the'
And in "MyCode2.pb"

Code: Select all

10 - a$ = "Green" 
11 - Debug a$ + " duck'
in line 122/123
The debugger must write a style of that ?
Debugger wrote:MyCode/123 => I love the
MyCode2/11 => Green duck
And like the native tool "search text in files" in actual IDE Edit menu , when you double click on each line, you go to the line 123 or 11 where is in the corresponding file pb code, on the IDE ?

Re: Debug Output Text color

Posted: Fri Feb 06, 2026 8:56 am
by Michael Vogel
Something like that, yes...

I know that I can do such things with #PB_Compiler_Line and #PB_Compiler_Procedure (see macro below) but it would be helpful to have such information automatically (could be shown in extra columns of a listicon gadget or only when hovering around with the mouse).

This information isn't useful in all cases but when trying to localize a bug in a larger source and adding many debug lines the debug output can be confusing, especially when just adding a simple 'Debug i' here and a 'Debug test' there.

Code: Select all

Macro Debug(output)
	
	#BirdsDebugCodeLineCharacterLength=	5
	#BirdsDebugPorcedureCharacterLimit=	6
	
	Debug LSet(#PB_Compiler_Procedure,#BirdsDebugPorcedureCharacterLimit)+"|"+RSet(Str(#PB_Compiler_Line),#BirdsDebugCodeLineCharacterLength)+" | "+output

EndMacro

Procedure loop(n)

	If n>0
		Debug(n)
		loop(n-1)
	EndIf

EndProcedure


Debug("TEST")
Debug(test)

loop(7)

Debug("All done "+test)

Re: Debug Output Text color

Posted: Fri Feb 06, 2026 9:32 am
by Kwai chang caine
Nice your MACRO :shock:
I never thinking to use a thing like that :oops:
Just use the #PB_Compiler_Procedure constant in my error msgbox in title for know what procedure is not happy :lol:

It's justly for this adding of all this style of really usefull temporary debug code that we must to add here, remove, add elsewhere, remove... Etc.. That i'm forcing to put my big snout into the IDE code source, at the begining for see quicly the value in the map in runtime :cry: