Sign in Join
Wiki copytemporary

Adding an About dialog as a property to a custom component

Summary

This article is for writers of Lazarus visual components (descended from TComponent or descendants)

This is what the application programmer would see when he drops your component onto a form:

Object Inspector example screenshot

About dialog example screenshot

License screen example screenshot

Download example code

You can download the full source as described in this article from the lazarus CCR here

Adding an About property to your new or existing component

  1. Rename aboutcomponentunit.pas to about<yourcomponentname>unit.pas
  2. In the pas file rename the Unit to match (1)
  3. Open the renamed pas file and do Search/Replace to change all instances of "TAboutComponent" to TAbout<yourcomponentname>
  4. In the line TAboutComponent = Class(TComponent), change the ancestor to your component's ancestor (if it's not TComponent)
  5. Add the edited pas file to your component's package
  6. In your component's class declaration, change it's ancestor to TAbout<yourcomponentname> (from step 3)
  7. Compile, install and see the new clickable 'About' property in your component!

Configuring the About property dialog

Example

text
TAboutScrollText = class(TComponent)

to

text
TAboutScrollText = class(TGraphicControl)
text
TScrollingText = class(TGraphicControl)

to

text
TScrollingText = class(TAboutScrollText)
pascal
constructor TScrollingText.Create(AOwner: TComponent);
begin
 inherited Create(AOwner);  
..other constructor code..
   // About dialog
 AboutBoxComponentName:='ScrollingText component';
 AboutBoxWidth:=400;
 // AboutBoxHeight (integer)
 AboutBoxDescription:='Component that shows a scrolling window.' + LineEnding +
 'Use Lines property to set text and Active=True' + LineEnding +
 'to use the component';
 AboutBoxBackgroundColor:=clWindow;
 AboutBoxFontName:='Arial';
 AboutBoxFontSize:=10;
 AboutBoxVersion:=C_VERSION;
 AboutBoxAuthorname:='Gordon Bamber';
 AboutBoxOrganisation:='Public Domain';
 AboutBoxAuthorEmail:='minesadorada@charcodelvalle.com';
 AboutBoxLicenseType:='LGPL';
end;

See Also


From the Free Pascal wiki, page "Adding an About dialog as a property to a custom component", as it stood on 2016-07-15 after a change by Arent, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 4, last changed by Arent .

Edited on wiki.freepascal.org by 3 people, 2014–2016

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
TorrenterExample code, screenshots and download link. First draft.
TorrenterUpdated example code
MinesadoradaMinor update (minor)
Torrenterminor additions (minor)
MinesadoradaRewrite to reflect newer code
Minesadorada (minor)
Minesadorada
Minesadorada
Minesadoradaupdated download link to lazarusccr (minor)
MinesadoradaAdded category (minor)
Arent

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.