Hanzaplastique Hanzaplastique - 2 months ago 10x
Pascal Question

Lazarus Pascal: How to debug a Widget Set (multiline Caption/Hint issue)

I'm not the most advanced programmer, but do love working with Lazarus.

Unfortunately, every now and then there is an issue or bug (like this one, bugreport), and I for one would like to help out and see if I can contribute by trying to debug this myself and provide a possible "fix".

The question I have is: How do I debug a widget set or the Object Inspector?

Short reason why:
When I enter a multiline caption or hint under Windows or Linux, then this works fine. Under MacOS X however (Carbon), the newline character(s) gets removed by the Object Inspector or the widget set and I have no clue where to look to try to fix this.

With what I was able to figure out myself;
I've narrowed down the issue to the Object Inspector or the Carbon widget set. Manually editing a form (lfm) works, doing it at runtime in code works, and multi-line captiosn or hints works fine under Windows and Linux.
So I suspect that the Carbon widget-set, used by the Object Inspector, is doing something wrong.

Any help to get me started is very much appreciated.

I apologize if this question is not appropriate or not specific enough - I'm just trying to find help in debugging this issue.


The IDE Object inspector is actually an advanced version of TTIPropertyGrid. If you want to debug it you can work on the package and test it in a simple project:

enter image description here

Then add a simple handler to test the inspector on the project form:

procedure TForm1.FormCreate(Sender: TObject);
  TIPropertyGrid1.TIObject := self;

When you'll modify a source in the package RunTimeTypeInfoControls, the changes won't be visible in the IDE but rather at run-time, in your sample project (package will be automatically recompiled).

It's also probable that you'll have to work on the PropEdits unit if the bug comes from the property editor itself (maybe TStringsPropertyEditor).

To avoid any laborious manipulation you can test your changes on a copy of the matching editor class and register it in the initialization section of your test project to replace the default, maybe buged, version.