Recent

Author Topic: Object Inspector Information Box  (Read 4291 times)

AL

  • Sr. Member
  • ****
  • Posts: 264
Object Inspector Information Box
« on: March 28, 2021, 12:58:35 am »
I am trying my hands at my first component/package.
I cannot find how to enter the information that is displayed in the object inspector information box for the different properties.

Did not see any in some LCL components source that I checked, so I assume it might be in a .res file.
Would be much appreciated is someone could point me to a documentation

Thanks
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1342
  • Professional amateur ;-P
Re: Object Inspector Information Box
« Reply #1 on: March 28, 2021, 08:41:38 am »
Hey Al,

If I'm not mistaken, it's been a while since I attempted my own component, the object inspector only shows PUBLISHED properties and not PUBLIC.

If that's not your case, I'm really sorry to have put my foot in mouth ;)

Cheers,
Gus

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: Object Inspector Information Box
« Reply #2 on: March 28, 2021, 09:12:29 am »
Gus is right, declare as published the properties you want to be able to change in the object inspector and they will appear there once the control/component is installed in the IDE.

You can find a little more info in the wiki: How To Write Lazarus Components, Lazarus Packages, etc.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1342
  • Professional amateur ;-P
Re: Object Inspector Information Box
« Reply #3 on: March 28, 2021, 09:22:03 am »
Hey Lucamar,

Uff, thanks for the save. I wasn't quite sure.

Just as a curiosity, does any of those links talk about the PITA that is to register custom editors for the properties that are a bit more complicated than the simple String, Integer, Float, you know, the basic ones?
Cuz I'm guessing this would be his next question... Mine was, long time ago, when I tried my own component.

Cheers,
Gus

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: Object Inspector Information Box
« Reply #4 on: March 28, 2021, 10:25:37 am »
Yes, it talks about it though, of course, in a sketchy way. Most properties will fit in any of the miriad of default editors.

It's not a piece of cake, granted (nothing ever seems to be in the end, isn't it? :)), but it's not so difficult either, at least not for dialog-style editors: descend a class from TPropertyEditor, program it adequately and register it with RegisterPropertyEditor.

But, yeah, that's glossing over a few captchas and gotchas you might find yourself mired in ... :-[
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1342
  • Professional amateur ;-P
Re: Object Inspector Information Box
« Reply #5 on: March 28, 2021, 11:09:00 am »
Hey Lucamar,

I think that pretty much sums up my experience with it. Although I'm, now, not completely sure if I popped my cherry on Delphi or Lazarus.
I did have to gloss over it when I started the qBittorrent component in Lazarus, but that's about it, a feeling, not a complete memory. I hate being old!!!

But yeah, nevermind.

@AL: First get the properties you want to edit on published, leave the rest on public and when you don't like the way the IDE let's you edit that property, just follow up on what Lucamar said:

It's not a piece of cake, granted (nothing ever seems to be in the end, isn't it? :)), but it's not so difficult either, at least not for dialog-style editors: descend a class from TPropertyEditor, program it adequately and register it with RegisterPropertyEditor.

Good luck my friend. You gonna need it. Component crafting is more akin to delicate magic than programming ;)

Cheers,
Gus
« Last Edit: March 28, 2021, 11:10:38 am by gcarreno »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4689
  • I like bugs.
Re: Object Inspector Information Box
« Reply #6 on: March 28, 2021, 11:20:36 am »
Hey guys, AL's question was about the information box in Object Inspector. Clearly his properties are already published.
The information box shows documentation for the selected property.
IIRC it comes from the XML documentation when available, but can also use a comment line above the property in source code.
I am not 100% sure. Please test it yourself.
I am applying many documentation patches but I am not involved in building the doc format files.
Also it has been a while since I worked on the OI information box code. I should refresh my knowledge...
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: Object Inspector Information Box
« Reply #7 on: March 28, 2021, 11:53:17 am »
Hey guys, AL's question was about the information box in Object Inspector. Clearly his properties are already published.
The information box shows documentation for the selected property.
[etc]

Yeah, I was beginning to suspect that :-[

I kind of recall, like you, that it was taken both from the XML help files and source comments, and I was looking for info on it but I don't remember where it came from: the wiki, this forum or somewhere else.

And yes, a simple test should show whether we are remembering it right
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1342
  • Professional amateur ;-P
Re: Object Inspector Information Box
« Reply #8 on: March 28, 2021, 12:01:08 pm »
Hey all,

Oh crap... Didn't I say that I most likely did a: Foot, meet mouth?

Sorry AL for the detour, I'll just shut up  :-[

Cheers,
Gus

wp

  • Hero Member
  • *****
  • Posts: 13400
Re: Object Inspector Information Box
« Reply #9 on: March 28, 2021, 12:13:11 pm »
I once took the time to add popup help to the TAChart package. Just repeated it for the ExCtrls package. These are the steps required:
  • In the package folder create a directory for the xml help files, in my case (exctrls)/fpdoc where (exctrls) stands for the directory of the exctrls package.
  • In the options of the package, go to "IDE Integration" and specify this folder name in the box "FPDoc settings" > "Search paths"
  • Open the FPDoc editor (menu "View"), and move it to a place on the screen so that you always have access to it.
  • Open the unit for which you want to write the documentation, in my case ExButtons.pas. Put the cursor in the source editor on the property to be documented (here: "property Alignment").
  • Since the help file does not yet exist, click "Create help item" in the FPDoc editor. This creates the ExButtons.xml file in the fpdoc folder of the package.
  • In the FPDoc editor, go to line "Short" and write a short description of that property. In my case: "Determines the alignment of the caption within the button (left, right, centered)". You can also add an extended description when you go to tab "Description" of the FPDoc editor, but normally "Short" is enough. In the side bar of the FPDoc editor, you can find some buttons which allow to highlight the selected text in the documentation.
  • Click the Save button of the FPDoc editor.
  • When you now move the mouse of the documented property in the source code editor the popup hint window will immediately show the new documentation text. And this happens also when you select the documented property in the Object Inspector and look at the Information Box
  • Repeat with the other properties, methods, procedures, declarations etc that you want to document.
In principle, a chm help file can be created from the xml documentation files written this way. But so far, I could not find a way to integrate chm files of third-party components into the IDE so that the help appears in the chm reader when F1 is pressed. It looks that this is only possible for LCL and LazUtils.

Warning: The FPDoc editor has its own ideas of xml formatting and this easily changes the formatting of the xml descriptions of all properties that it can find. This will create a lot of noise in the version control of the xml help files. I recommend to close the FPDoc editor when it is not needed any more.



Soner

  • Sr. Member
  • ****
  • Posts: 328
Re: Object Inspector Information Box
« Reply #10 on: March 28, 2021, 01:03:11 pm »
You don't need xml-files for this.
As Juha said make comment above the property or behind in the same line.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4689
  • I like bugs.
Re: Object Inspector Information Box
« Reply #11 on: March 28, 2021, 02:09:58 pm »
In principle, a chm help file can be created from the xml documentation files written this way. But so far, I could not find a way to integrate chm files of third-party components into the IDE so that the help appears in the chm reader when F1 is pressed. It looks that this is only possible for LCL and LazUtils.
Does it work if you copy the CHM file into the directory known by IDE?
With trunk I copied all CHM files to docs/chm directory and it works. I don't even know how the IDE finds them there. It is not configured anywhere. Must be hard-coded.
My CHM files include RTL and FCL, they also work. Even the builtin functions like Delete() work now after Mattias fixed it.

In the global options there is Help -> External. I have no idea how to use it.

Quote
Warning: The FPDoc editor has its own ideas of xml formatting and this easily changes the formatting of the xml descriptions of all properties that it can find. This will create a lot of noise in the version control of the xml help files. I recommend to close the FPDoc editor when it is not needed any more.
Yes and the formatting it generates is not nice to read. Somebody should take a project to make the FPDoc's XML output human readable. Sometimes it is useful to view and modify XML by any text editor.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

wp

  • Hero Member
  • *****
  • Posts: 13400
Re: Object Inspector Information Box
« Reply #12 on: March 28, 2021, 03:00:17 pm »
In principle, a chm help file can be created from the xml documentation files written this way. But so far, I could not find a way to integrate chm files of third-party components into the IDE so that the help appears in the chm reader when F1 is pressed. It looks that this is only possible for LCL and LazUtils.
Does it work if you copy the CHM file into the directory known by IDE?
No. Certainly the new file must be registered somehow. I already had asked this question on the devs mailing list, and somebody had answered that the cml files of LCL, LazUtils, RTL etc are hard-coded, and then I gave up.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12706
  • FPC developer.
Re: Object Inspector Information Box
« Reply #13 on: March 28, 2021, 03:10:17 pm »
A bit grepping yields

Hardcoded in components\chmhelp\packages/idehelp

chmprog.pas:    Result := '$(LazarusDir)/docs/chm;$(LazarusDir)/docs/html';
lazchmhelp.pas:    Result:='$(LazarusDir)/docs/chm;$(LazarusDir)/docs/html;$(LazarusDir)/docs/html/lcl';

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4689
  • I like bugs.
Re: Object Inspector Information Box
« Reply #14 on: March 28, 2021, 03:34:36 pm »
Ok, not perfect.
There should be a way to configure a path for CHM files per package, similar with the current XML file configuration.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018