Recent

Author Topic: Search in Watches window.  (Read 465 times)

Hansvb

  • Hero Member
  • *****
  • Posts: 752
Search in Watches window.
« on: February 08, 2025, 10:36:23 am »
Hi,

Is there a way to search in the Watches window? See the attachments, I have a variable of the type TPanel and I want to look up the name in the watches window then I have to scroll until I come across FNAME. I could also temporarily put an extra line with aPanel.Name in the code, but sometimes a quick look in the watches window is easy.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10897
  • Debugger - SynEdit - and more
    • wiki
Re: Search in Watches window.
« Reply #1 on: February 08, 2025, 01:12:18 pm »
Unfortunately not (though no my own wish & todo list already).

However (In Lazarus 4.0(RC)), if you want to search within one specific watch, right click that watch, and "Inspect" it. In the inspect Window there is a search field. It searches field names and content. Once found the field of interest, click "Add Watch" and have a new watch for it.

In the watches window, while there is no search, once you have found a field of interest (in an expanded watch), then you can drag and drop that field to a position outside the expanded area. And that creates a new watch too, showing you that field without the need to expand all fields.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10897
  • Debugger - SynEdit - and more
    • wiki
Re: Search in Watches window.
« Reply #2 on: February 08, 2025, 01:17:59 pm »
If you have "Sender: TObject" and you don't know which class it is...

As long as you have sender and expand it => it follows the current class. But if you use any of the above methods, your new watch will be

TPanel(Sender).Name

If sender could be another class, and maybe even without a common base class for a shared name, then you can do

:cc(Sender).Name

":cc()" will "ClassCast" to whatever it currently is. It then does the correct lookup of name (or will say, that there is no name, if Sender is of a class that does not have a name.

Hansvb

  • Hero Member
  • *****
  • Posts: 752
Re: Search in Watches window.
« Reply #3 on: February 08, 2025, 03:53:35 pm »
Inspect... I hadn't thought of that. With that you can indeed filter and I find Name easy.

 

TinyPortal © 2005-2018