PosSizer - PrintDebug
Author: Grieger
Creation Date: 4/22/2010 10:07 AM
profile picture

Grieger

#1
Hello,

for debugging reasons I would like to print lines into the PrintDebug (window) from within a PosSizer (extension dll).


CODE:
Please log in to see this code.


Is it possible to access the PrintDebug method from within a PosSizer or is there another way to receive a simple output?

profile picture

dan_rozenberg

#2
I don't think you can call printdebug(), but you can call MessageBox.Show("Text").
profile picture

Eugene

#3
Printing to Wealth-Lab's debug window from a PosSizer is very unlikely as Dan notes, but don't get upset - you don't need it at all. Visual Studio or SharpDevelop provides you with much more flexible instruments for debugging - attach-to-process, adding breakpoints, the Watch window, the Locals, etc.

Last but not least, you're able to connect any .NET logging factory to your PosSizer - WL5 already employs log4net to write its log files, so can you.

P.S. Don't forget to check that currentPos != null before accessing its properties.
profile picture

Eugene

#4
Here's good solution to have "PrintDebug" in Visual Studio (works in Express editions too and should apply to SharpDevelop as well):

1. Call Trace.WriteLine in your PosSizer:
CODE:
Please log in to see this code.

2. Hit Ctrl-W, O to open the Output window. Voilà.
profile picture

dansmo

#5
@ Eugene

QUOTE:
WL5 already employs log4net to write its log files


Where do I find these log files?

QUOTE:
2. Hit Ctrl-W, O to open the Output window. Voilà.


I dont get it. Where do I have to type this combination? In WL5?
profile picture

Eugene

#6
QUOTE:
I dont get it. Where do I have to type this combination? In WL5?

I wasn't clear, sorry. In Visual Studio or SharpDevelop, of course. PosSizer will "PrintDebug" anything to the "Output" window of your IDE.
profile picture

dansmo

#7
Hmm, that is what I have:
CODE:
Please log in to see this code.


This will give me nothing in the ouput window, however.
Do I have to set up anything special?
profile picture

Eugene

#8
Start your solution in Debug mode and set "Show output from" to "Debug".

Of course, the code line should be accessible - e.g. outside of an "if" condition which evaluates to false. Inserting a breakpoint is a foolproof way to find out.

For further help on this, please see any Visual Studio resources/books.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).