Recent

Author Topic: Pointer range in watches  (Read 3556 times)

440bx

  • Hero Member
  • *****
  • Posts: 4987
Pointer range in watches
« on: May 27, 2024, 10:44:37 pm »
Hello,

I'm unclear as to what the behavior should be when setting the bounds between the "+" and "-" in the watch properties.

Please refer to the screenshot. 

I started watching the first 21st elements of an array by setting the "Expression" to:
Code: Pascal  [Select][+][-]
  1. ProgramData.PD_PE_DATA.PED_RUNTIME_FUNCTIONS.RT_FUNCTIONS_TABLE[0..20]
then I wanted to see more elements and simply changed the upper bound to "30" in the properties window but, that seems to be ignored.

My question is: should the new value be ignored because it is outside the bounds of the original boundaries or should the new value in the properties window have replaced the upper bound in the expression ?

It would be nice if it automatically replaced the upper bound in the expression. That would save having to set it manually.

PS: Lazarus v3.99 (trunk) downloaded today (5/27/2024)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10791
  • Debugger - SynEdit - and more
    • wiki
Re: Pointer range in watches
« Reply #1 on: May 28, 2024, 08:57:32 am »
It seems it isn't currently documented... https://wiki.lazarus.freepascal.org/IDE_Window:_Watch_list#Viewing/Expanding_Arrays

The embedded toolbar by default works inside the range of the returned watch (in your case 0..20).

That is, so that the last page ends at the end of the array. If your 21 entries were paginated on pages with 10 elements, then the last page would only show 1 element. Sparing you the random data after your array. (for the toolbar, this is not distinguishable from a real array, and even if it was it would not know if you had chosen the maximum value for the index)

However, if the start point is forcefully set outside the bounds, then it will give up enforcing those bounds.
So in your case, if you set the start or -1 or 21 then the paging will show more values.
The arrows will not set those values. You have to type them directly into the edit fields.

Since the default for pagination size can be bigger than the array (e.g. an array with 5 elements, but pagination starts at 10 per page), the page size is not used to determine if bounds should be ignored.

440bx

  • Hero Member
  • *****
  • Posts: 4987
Re: Pointer range in watches
« Reply #2 on: May 28, 2024, 11:19:04 am »
Now I understand.  In one case, it's boundary control in the other it's pagination, which is a different thing.

Thank you Martin. :)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10791
  • Debugger - SynEdit - and more
    • wiki
Re: Pointer range in watches
« Reply #3 on: August 22, 2024, 11:48:44 am »
The pagination now has an explicit setting for enforcing the bounds.

You should now be able to uncheck it, and enter any bounds you want.

440bx

  • Hero Member
  • *****
  • Posts: 4987
Re: Pointer range in watches
« Reply #4 on: August 22, 2024, 02:12:07 pm »
Great!  Thank you Martin.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10791
  • Debugger - SynEdit - and more
    • wiki
Re: Pointer range in watches
« Reply #5 on: August 25, 2024, 12:37:12 am »
I also added some defaults into displayformat (global in tools options / and in project settings / Valueformatter dislpayformat / and in per each watch).

The default for page size can be set. And defaults for Enforce bounds, and autohide.

The values are copied when the nav bar is created => when an array is expanded for the very first time.  They are then kept (do not follow changes in watch properties which acts as default). If the watch becomes non-array, the nav bar is destroyed, and thus values will be re-read for the next array (if the watch becomes array again).

Values for ensure-bounds and autohide are written back to the watch, if they are changed in the nav bar.
The default for the page size is not changed in the watch.

nav-bars for nested should read the default for the top level watch. They do not write their changes to anywhere, as there is no storage for nested watches (yet).

 

TinyPortal © 2005-2018