[Lazarus] (Local) variable value hints

Ondrej Pokorny lazarus at kluug.net
Tue Jun 6 21:58:55 CEST 2017


On 06.06.2017 21:54, Mark Morgan Lloyd via Lazarus wrote:
> Bearing in mind things like the %H hint that Lazarus uses to suppress 
> warning messages, is there anything comparable that can be applied to 
> a variable so that when the IDE pops up a value during debugging it 
> will always be shown in a certain format?
>
> ..
> end else begin
>   euCount := cardEsu;
>   euVector := sysEuVector <=== THIS ONLY MEANINGFUL AS HEX OR BINARY

You can define your own value formatter with 
TBaseDebugManagerIntf.RegisterValueFormatter

But: it works on a type-basis and not variable name basis. So define a 
specific type euVector:

   TeuVector = type Integer; // or type whatever

and then register it with RegisterValueFormatter(skSimple, 'TeuVector', 
@MyFormatFunction);

See how TDateTime is handled in ide/debugmanager.pas

Ondrej


More information about the Lazarus mailing list