Recent

Author Topic: How to change the display to hexadecimal ?  (Read 1397 times)

440bx

  • Sr. Member
  • ****
  • Posts: 391
How to change the display to hexadecimal ?
« on: August 11, 2018, 04:58:56 am »
Hello,

One very nice feature when debugging is that you can place the mouse over a data structure and after a second (or so) a window showing the values of all the fields in the data structure pops up.

The "problem" is that the values of integer fields (byte, word, dword, etc) are shown in decimal and I'd like to have them shown in hexadecimal.

Is there a way to configure that popup to show the values in hex instead of decimal ?

Thanks.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4952
    • wiki
Re: How to change the display to hexadecimal ?
« Reply #1 on: August 11, 2018, 11:15:45 am »
Only in the watches window. There you can use the properties of each watched value.

The debug hint does not have that.

440bx

  • Sr. Member
  • ****
  • Posts: 391
Re: How to change the display to hexadecimal ?
« Reply #2 on: August 11, 2018, 01:14:18 pm »
Only in the watches window. There you can use the properties of each watched value.

The debug hint does not have that.
Thank you Martin.   I'll just have to get used to decimals.  My grocery store is like that too, I asked them to put the prices in hex but, they didn't go for it.

Ondrej Pokorny

  • Full Member
  • ***
  • Posts: 205
Re: How to change the display to hexadecimal ?
« Reply #3 on: August 13, 2018, 10:16:26 am »
The debug hint does not have that.

It has. See how TDateTime is implemented: unit "ide\debugmanager.pas" in constructor TDebugManager.Create(TheOwner: TComponent);

RegisterValueFormatter(skSimple, 'TDate', @DBGDateTimeFormatter);

- you can install your own value formatter for every type in your IDE extension package

ASerge

  • Hero Member
  • *****
  • Posts: 998
Re: How to change the display to hexadecimal ?
« Reply #4 on: August 13, 2018, 07:48:16 pm »
Here's a simple package implementing what Ondrej Pokorny has pointed out.

wp

  • Hero Member
  • *****
  • Posts: 5150
Re: How to change the display to hexadecimal ?
« Reply #5 on: August 13, 2018, 08:04:09 pm »
Excellent! I've been missing this all the time. Could you write a bugtracker feature request to get it added to the IDE?
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

440bx

  • Sr. Member
  • ****
  • Posts: 391
Re: How to change the display to hexadecimal ?
« Reply #6 on: August 13, 2018, 09:00:34 pm »
Excellent! I've been missing this all the time. Could you write a bugtracker feature request to get it added to the IDE?

I second wp's opinion, that is excellent indeed.    Thank you Serge.

Here is to show that I am still a clueless noobie.  I installed the package (lazarus recompiled successfully), checked in the "install/uninstall package" and it is in the list of installed packages.  In spite of that, I still get the values in decimal. 

What did I miss to have the values in hex ?  Do I need to add a "uses <something>" to my code ?

Thanks.




wp

  • Hero Member
  • *****
  • Posts: 5150
Re: How to change the display to hexadecimal ?
« Reply #7 on: August 13, 2018, 09:22:11 pm »
Did you click "Save and rebuild IDE"? Or, in the dialog in which you loaded the package you must click "Use" > "Install", not only "Compile".

This will rebuild the IDE with the new package included. It will take a while... When finished Lazarus will restart.

Then you set a breakpoint in your program, compile and run it. When the program stops at the breakpoint you hover the mouse above a numeric variable, and the popup will show you the decimal and hex value of the variable.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

440bx

  • Sr. Member
  • ****
  • Posts: 391
Re: How to change the display to hexadecimal ?
« Reply #8 on: August 13, 2018, 09:30:50 pm »
Then you set a breakpoint in your program, compile and run it. When the program stops at the breakpoint you hover the mouse above a numeric variable, and the popup will show you the decimal and hex value of the variable.

Thanks wp.  It works exactly as you described it.  The problem is, I am/was hovering over a record with a bunch of fields  (that's the variable I'm particularly interested in seeing in hex) and, in records, it still shows the values in decimal.  I suppose the package doesn't support record fields.