Recent

Author Topic: Contents of the Information Box for custom components?  (Read 3300 times)

CM630

  • Hero Member
  • *****
  • Posts: 1615
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Contents of the Information Box for custom components?
« on: February 26, 2025, 02:14:01 pm »
How to create contents for the Information Box of the Lazarus IDE?
I found some XLM files in ...\components\tachart\fpdoc\ but I wonder are these files made with a dedicated tool and how shall they be linked to the component?
I found no info here: https://wiki.freepascal.org/How_To_Write_Lazarus_Component
« Last Edit: March 02, 2025, 08:51:07 pm by CM630 »
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

dsiders

  • Hero Member
  • *****
  • Posts: 1525
Re: Contents of the Information Box for custom components?
« Reply #1 on: February 26, 2025, 04:33:29 pm »
How to create contents for the Information Box of the Lazarus IDE?
I found some XLM files in ...\components\tachart\fpdoc\ but I wonder are these files made with a dedicated tool and how shall they be linked to the component?
I found no info here: https://wiki.freepascal.org/How_To_Write_Lazarus_Component

Use the View > FPDoc Editor menu option to open an editor for a given unit. In reality, any text editor can be used.

CM630

  • Hero Member
  • *****
  • Posts: 1615
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Contents of the Information Box for custom components?
« Reply #2 on: February 28, 2025, 04:09:47 pm »
Thanks, your link lead to https://wiki.freepascal.org/Lazarus_Documentation_Editor.
I think I have seen some comments near the properties in .pas files, probably I am wrong, which explains why most 3th party components have no hints.
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

dsiders

  • Hero Member
  • *****
  • Posts: 1525
Re: Contents of the Information Box for custom components?
« Reply #3 on: February 28, 2025, 07:07:58 pm »
Thanks, your link lead to https://wiki.freepascal.org/Lazarus_Documentation_Editor.
I think I have seen some comments near the properties in .pas files, probably I am wrong, which explains why most 3th party components have no hints.

If you're saying TAChart help does not display anything in the info box, or code help, or hints... that is not true.See attached.

But it can only display help topics when help topics are present.

If you're actually referring to F1 context-sensitive help, that's a whole other ball of wax... and yes, it's practically non-existent for 3rd party help. If you look for forum posts  about externalhelp, you'll see suggestions on how to work around this. But it is less than ideal.



« Last Edit: February 28, 2025, 07:12:30 pm by dsiders »

CM630

  • Hero Member
  • *****
  • Posts: 1615
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Contents of the Information Box for custom components?
« Reply #4 on: February 28, 2025, 09:13:39 pm »
...If you're saying TAChart help does not display anything in the info box, or code help, or hints... that is not true.See attached...
I am talking exactly about the thing in the bottom left of your screenshot. TAChart has it, that is why used it as an example.
I examined some stuff from the Online Package Manager, it occurs that UE Controls have info for the Information Box, so probably I can use them from the example.
Thanks!
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

dsiders

  • Hero Member
  • *****
  • Posts: 1525
Re: Contents of the Information Box for custom components?
« Reply #5 on: March 01, 2025, 07:30:27 am »
...If you're saying TAChart help does not display anything in the info box, or code help, or hints... that is not true.See attached...
I am talking exactly about the thing in the bottom left of your screenshot. TAChart has it, that is why used it as an example.
I examined some stuff from the Online Package Manager, it occurs that UE Controls have info for the Information Box, so probably I can use them from the example.
Thanks!

I don't know anything about UE Controls. Do they provide the XML files for their help? That's where the  content in the Information Box, Hints, and Code Help comes from. It's configured and turned on by setting  the Project Options > FP Doc Editor tab. Packages have the same capability using the Package Options > IDE Integration tab.
« Last Edit: March 01, 2025, 07:32:33 am by dsiders »

bobby100

  • Sr. Member
  • ****
  • Posts: 301
    • Malzilla
Re: [ANSWERED] Contents of the Information Box for custom components?
« Reply #6 on: March 01, 2025, 07:11:05 pm »
In the Interface section, write a comment one line before the variable or object declaration - this will appear as a info in the IDE.
Code: Pascal  [Select][+][-]
  1. {
  2.  *****************************************************************************
  3.   See the file COPYING.modifiedLGPL.txt, included in this distribution,
  4.   for details about the license.
  5.  *****************************************************************************
  6.  
  7.  Author: Boban Spasic
  8.  Credits to: circular from Lazarus forum
  9. }
  10.  
  11. unit BCLeaLED;
  12.  
  13. {$mode ObjFPC}{$H+}
  14.  
  15. interface
  16.  
  17. uses
  18.   Classes, SysUtils, Controls, LResources, Graphics,
  19.   BGRABitmapTypes, BGRABitmap, BGRAGradients, BCLeaTheme, BCLeaTypes;
  20.  
  21. type
  22.   TBCLeaLED = class(TCustomControl)
  23.   private
  24.     FBitmap: TBGRABitmap;
  25.     FTheme: TBCLeaTheme;
  26.     FOnChangeValue: TNotifyEvent;
  27.     FValue: boolean;
  28.     FColorOn: TColor;
  29.     FColorOff: TColor;
  30.     FBkgColor: TColor;
  31.     FStyle: TZStyle;
  32.     FSize: integer;
  33.     FAltitude: integer;
  34.     FClickable: boolean;
  35.     //global intensity of the light
  36.     FLightSourceIntensity: single;
  37.     //minimum distance always added (positive value)
  38.     FLightSourceDistanceTerm: single;
  39.     //how much actual distance is taken into account (usually 0 or 1)
  40.     FLightSourceDistanceFactor: single;
  41.     //how much the location of the lightened pixel is taken into account (usually 0 or 1)
  42.     FLightDestFactor: single;
  43.     //color of the light reflection
  44.     FLightColor: TColor;
  45.     //how much light is reflected (0..1)
  46.     FSpecularFactor: single;
  47.     //how concentrated reflected light is (positive value)
  48.     FSpecularIndex: single;
  49.     //ambiant lighting whereever the point is (0..1)
  50.     FAmbientFactor: single;
  51.     //diffusion, i.e. how much pixels are lightened by light source (0..1)
  52.     FDiffusionFactor: single;
  53.     //how much hidden surface are darkened (0..1)
  54.     FNegativeDiffusionFactor: single;
  55.     //when diffusion saturates, use light color to show it
  56.     FDiffuseSaturation: boolean;
  57.  

CM630

  • Hero Member
  • *****
  • Posts: 1615
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: [ANSWERED] Contents of the Information Box for custom components?
« Reply #7 on: March 02, 2025, 08:50:12 pm »
It does not work for me.
I have also added comments before the declarations of the properties, still the same.
Maybe I shall activate it in some properties of the LPK?
« Last Edit: March 02, 2025, 09:28:55 pm by CM630 »
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

dsiders

  • Hero Member
  • *****
  • Posts: 1525
Re: [ANSWERED] Contents of the Information Box for custom components?
« Reply #8 on: March 02, 2025, 10:13:17 pm »
It does not work for me.
I have also added comments before the declarations of the properties, still the same.
Maybe I shall activate it in some properties of the LPK?

Everything in the Information Box originates in an .xml file found in the directory specified in the project or package options. Not a comment.

The Code Help pop-up can use comment though... if a help topic is not found.

bobby100

  • Sr. Member
  • ****
  • Posts: 301
    • Malzilla
Re: Contents of the Information Box for custom components?
« Reply #9 on: March 03, 2025, 06:37:53 pm »
@CM630
I see where I made an error. Please insert a blank space at the beginning of the comment:
Code: Pascal  [Select][+][-]
  1.     // The text to display
  2.     // It will be truncated according
  3.     // to ScreenRowCount and ScreenColCount
  4.     property Lines: TStrings read FLines write SetLines;
This still works for me.

CM630

  • Hero Member
  • *****
  • Posts: 1615
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Contents of the Information Box for custom components?
« Reply #10 on: March 04, 2025, 01:18:27 pm »
Quote
`Curiouser and curiouser!' cried Alice

I took BGRABitmats from Git*, I added some comments. I even renamed ColorOff to ColourOff, to make sure that that package is recompiled and reinstalled. Still nothing in the information box. :o
There is no .XML for BCLeaLED.

Code: Pascal  [Select][+][-]
  1. {
  2.  *****************************************************************************
  3.   See the file COPYING.modifiedLGPL.txt, included in this distribution,
  4.   for details about the license.
  5.  *****************************************************************************
  6.  
  7.  Author: Boban Spasic
  8.  Credits to: circular from Lazarus forum
  9. }
  10.  
  11. unit BCLeaLED;
  12.  
  13. {$mode ObjFPC}{$H+}
  14.  
  15. interface
  16.  
  17. uses
  18.   Classes, SysUtils, Controls, LResources, Graphics,
  19.   BGRABitmapTypes, BGRABitmap, BGRAGradients, BCLeaTheme, BCLeaTypes;
  20.  
  21. type
  22.   TBCLeaLED = class(TCustomControl)
  23.   private
  24.     FBitmap: TBGRABitmap;
  25.     FTheme: TBCLeaTheme;
  26.     FOnChangeValue: TNotifyEvent;
  27.     FValue: boolean;
  28.     FColorOn: TColor;
  29.     FColorOff: TColor;
  30.     FBkgColor: TColor;
  31.     FStyle: TZStyle;
  32.     FSize: integer;
  33.     FAltitude: integer;
  34.     FClickable: boolean;
  35.     // global intensity of the light
  36.     FLightSourceIntensity: single;
  37.     // minimum distance always added (positive value)
  38.     FLightSourceDistanceTerm: single;
  39.     // how much actual distance is taken into account (usually 0 or 1)
  40.     FLightSourceDistanceFactor: single;
  41.     // how much the location of the lightened pixel is taken into account (usually 0 or 1)
  42.     FLightDestFactor: single;
  43.     // color of the light reflection
  44.     FLightColor: TColor;
  45.     // how much light is reflected (0..1)
  46.     FSpecularFactor: single;
  47.     // how concentrated reflected light is (positive value)
  48.     FSpecularIndex: single;
  49.     // ambiant lighting whereever the point is (0..1)
  50.     FAmbientFactor: single;
  51.     // diffusion, i.e. how much pixels are lightened by light source (0..1)
  52.     FDiffusionFactor: single;
  53.     // how much hidden surface are darkened (0..1)
  54.     FNegativeDiffusionFactor: single;
  55.     // when diffusion saturates, use light color to show it
  56.     FDiffuseSaturation: boolean;
  57.     FLightPositionX: integer;
  58.     FLightPositionY: integer;
  59.     FLightPositionZ: integer;
  60.     procedure SetValue(AValue: boolean);
  61.     procedure SetAltitude(AValue: integer);
  62.     procedure SetColorOn(AValue: TColor);
  63.     procedure SetColorOff(AValue: TColor);
  64.     procedure SetBkgColor(AValue: TColor);
  65.     procedure SetStyle(AValue: TZStyle);
  66.     procedure SetSize(AValue: integer);
  67.     procedure SetClickable(AValue: boolean);
  68.     procedure SetTheme(AValue: TBCLeaTheme);
  69.   protected
  70.     procedure SetEnabled(Value: boolean); override;
  71.     procedure SetVisible(Value: boolean); override;
  72.     procedure Paint; override;
  73.     procedure Redraw;
  74.     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
  75.     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override;
  76.     procedure MouseMove(Shift: TShiftState; X, Y: integer); override;
  77.   public
  78.     constructor Create(AOwner: TComponent); override;
  79.     destructor Destroy; override;
  80.     procedure UpdateTheme;
  81.     procedure ApplyTheme;
  82.     procedure SaveThemeToFile(AFileName: string);
  83.     procedure LoadThemeFromFile(AFileName: string);
  84.     procedure ApplyDefaultTheme;
  85.   published
  86.     property Align;
  87.     property Cursor;
  88.     property Enabled;
  89.     property Font;
  90.     property ParentColor;
  91.     property ParentFont;
  92.     property ParentShowHint;
  93.     property PopupMenu;
  94.     property ShowHint;
  95.     property TabOrder;
  96.     property TabStop default True;
  97.     property Anchors;
  98.     property Constraints;
  99.     property Visible;
  100.     property OnClick;
  101.     property OnDblClick;
  102.     property OnEnter;
  103.     property OnExit;
  104.     property OnMouseMove;
  105.     property OnMouseDown;
  106.     property OnMouseUp;
  107.     property OnMouseWheel;
  108.     property OnMouseWheelDown;
  109.     property OnMouseWheelUp;
  110.     property OnKeyDown;
  111.     property OnKeyUp;
  112.     property OnKeyPress;
  113.     property OnContextPopup;
  114.     // Hint Value
  115.     property Value: boolean read FValue write SetValue default False;
  116.     // Hint ColorOn
  117.     property ColourOn: TColor read FColorOn write SetColorOn default TColor($00FF9C15);
  118.     // Hint ColorOff
  119.     property ColourOff: TColor read FColorOff write SetColorOff default TColor($009E5A00);
  120.     // Hint Background colour
  121.     property BackgroundColor: TColor read FBkgColor write SetBkgColor default clBtnFace;
  122.     property Size: integer read FSize write SetSize default 15;
  123.     property OnChangeValue: TNotifyEvent read FOnChangeValue write FOnChangeValue;
  124.     property Style: TZStyle read FStyle write SetStyle default zsRaised;
  125.     property Clickable: boolean read FClickable write SetClickable default False;
  126.     property Theme: TBCLeaTheme read FTheme write SetTheme;
  127.     property Altitude: integer read FAltitude write SetAltitude default 2;
  128.   end;
  129.  
  130. procedure Register;
  131.  
  132. implementation
  133.  
  134. procedure Register;
  135. begin
  136.   RegisterComponents('BGRA Controls', [TBCLeaLED]);
  137. end;
  138.  
  139. constructor TBCLeaLED.Create(AOwner: TComponent);
  140. begin
  141.   inherited Create(AOwner);
  142.  
  143.   with GetControlClassDefaultSize do
  144.     SetInitialBounds(0, 0, 50, 50);
  145.   FValue := False;
  146.   FBitmap := TBGRABitmap.Create(Width, Height, FBkgColor);
  147.   FClickable := False;
  148.   ApplyDefaultTheme;
  149. end;
  150.  
  151. destructor TBCLeaLED.Destroy;
  152. begin
  153.   FreeAndNil(FBitmap);
  154.   inherited Destroy;
  155. end;
  156.  
  157. procedure TBCLeaLED.SetEnabled(Value: boolean);
  158. begin
  159.   inherited SetEnabled(Value);
  160.   Invalidate;
  161. end;
  162.  
  163. procedure TBCLeaLED.SetVisible(Value: boolean);
  164. begin
  165.   inherited SetVisible(Value);
  166.   Invalidate;
  167. end;
  168.  
  169. procedure TBCLeaLED.Paint;
  170. begin
  171.   inherited Paint;
  172.   Redraw;
  173. end;
  174.  
  175. procedure TBCLeaLED.SetStyle(AValue: TZStyle);
  176. begin
  177.   if FStyle = AValue then
  178.     Exit;
  179.   FStyle := AValue;
  180.   Invalidate;
  181. end;
  182.  
  183. procedure TBCLeaLED.SetValue(AValue: boolean);
  184. begin
  185.   if FValue = AValue then
  186.     exit;
  187.   FValue := AValue;
  188.   Invalidate;
  189. end;
  190.  
  191. procedure TBCLeaLED.SetSize(AValue: integer);
  192. begin
  193.   if FSize = AValue then
  194.     exit;
  195.   FSize := AValue;
  196.   if FSize < 1 then FSize := 1;
  197.   Invalidate;
  198. end;
  199.  
  200. procedure TBCLeaLED.SetColorOn(AValue: TColor);
  201. begin
  202.   if FColorOn = AValue then
  203.     Exit;
  204.   FColorOn := AValue;
  205.   Invalidate;
  206. end;
  207.  
  208. procedure TBCLeaLED.SetColorOff(AValue: TColor);
  209. begin
  210.   if FColorOff = AValue then
  211.     Exit;
  212.   FColorOff := AValue;
  213.   Invalidate;
  214. end;
  215.  
  216. procedure TBCLeaLED.SetBkgColor(AValue: TColor);
  217. begin
  218.   if FBkgColor = AValue then
  219.     Exit;
  220.   FBkgColor := AValue;
  221.   Invalidate;
  222. end;
  223.  
  224. procedure TBCLeaLED.SetAltitude(AValue: integer);
  225. begin
  226.   if FAltitude = AValue then
  227.     Exit;
  228.   FAltitude := AValue;
  229.   Invalidate;
  230. end;
  231.  
  232. procedure TBCLeaLED.SetClickable(AValue: boolean);
  233. begin
  234.   if FClickable = AValue then
  235.     Exit;
  236.   FClickable := AValue;
  237.   Invalidate;
  238. end;
  239.  
  240. procedure TBCLeaLED.SetTheme(AValue: TBCLeaTheme);
  241. begin
  242.   if FTheme = AValue then
  243.     Exit;
  244.   if Assigned(FTheme) then
  245.     FTheme := nil;
  246.   FTheme := AValue;
  247.   ApplyTheme;
  248. end;
  249.  
  250. procedure TBCLeaLED.UpdateTheme;
  251. begin
  252.   if Assigned(FTheme) then
  253.   begin
  254.     FTheme.LED_ColorOn := FColorOn;
  255.     FTheme.LED_ColorOff := FColorOff;
  256.     FTheme.LED_BkgColor := FBkgColor;
  257.     FTheme.LED_Style := FStyle;
  258.     FTheme.LED_Size := FSize;
  259.     FTheme.LED_Altitude := FAltitude;
  260.   end;
  261. end;
  262.  
  263. procedure TBCLeaLED.ApplyTheme;
  264. begin
  265.   if Assigned(FTheme) then
  266.   begin
  267.     FColorOn := FTheme.LED_ColorOn;
  268.     FColorOff := FTheme.LED_ColorOff;
  269.     FBkgColor := FTheme.LED_BkgColor;
  270.     FStyle := FTheme.LED_Style;
  271.     FSize := FTheme.LED_Size;
  272.     FAltitude := FTHeme.LED_Altitude;
  273.     FLightSourceIntensity := FTheme.COM_LightSourceIntensity;
  274.     FLightSourceDistanceTerm := FTheme.COM_LightSourceDistanceTerm;
  275.     FLightSourceDistanceFactor := FTheme.COM_LightSourceDistanceFactor;
  276.     FLightDestFactor := FTheme.COM_LightDestFactor;
  277.     FLightColor := FTheme.COM_LightColor;
  278.     FSpecularFactor := FTheme.COM_SpecularFactor;
  279.     FSpecularIndex := FTheme.COM_SpecularIndex;
  280.     FAmbientFactor := FTheme.COM_AmbientFactor;
  281.     FDiffusionFactor := FTheme.COM_DiffusionFactor;
  282.     FNegativeDiffusionFactor := FTheme.COM_NegativeDiffusionFactor;
  283.     FDiffuseSaturation := FTheme.COM_DiffuseSaturation;
  284.     FLightPositionX := FTheme.COM_LightPositionX;
  285.     FLightPositionY := FTheme.COM_LightPositionY;
  286.     FLightPositionZ := FTheme.COM_LightPositionZ;
  287.     Invalidate;
  288.   end
  289.   else
  290.   begin
  291.     ApplyDefaultTheme;
  292.   end;
  293. end;
  294.  
  295. procedure TBCLeaLED.SaveThemeToFile(AFileName: string);
  296. begin
  297.   if Assigned(FTheme) then
  298.     FTheme.SaveThemeToFile(AFileName);
  299. end;
  300.  
  301. procedure TBCLeaLED.LoadThemeFromFile(AFileName: string);
  302. begin
  303.   if Assigned(FTheme) then
  304.     FTheme.LoadThemeFromFile(AFileName);
  305. end;
  306.  
  307. procedure TBCLeaLED.ApplyDefaultTheme;
  308. begin
  309.   FColorOn := TColor($00FF9C15);
  310.   FColorOff := TColor($009E5A00);
  311.   FBkgColor := clBtnFace;
  312.   FStyle := zsRaised;
  313.   FSize := 15;
  314.   FAltitude := 2;
  315.   FAmbientFactor := 0.3;
  316.   FSpecularIndex := 10;
  317.   FSpecularFactor := 0.6;
  318.   FLightDestFactor := 1;
  319.   FLightPositionX := -100;
  320.   FLightPositionY := -100;
  321.   FLightPositionZ := 100;
  322.   FLightSourceIntensity := 500;
  323.   FLightSourceDistanceTerm := 150;
  324.   FLightSourceDistanceFactor := 1;
  325.   FNegativeDiffusionFactor := 0.1;
  326.   FLightColor := clWhite;
  327.   FDiffuseSaturation := False;
  328.   FDiffusionFactor := 0.9;
  329. end;
  330.  
  331. procedure TBCLeaLED.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer);
  332. begin
  333.   inherited MouseDown(Button, Shift, X, Y);
  334.   if FClickable and (Button = mbLeft) then
  335.   begin
  336.     FValue := not FValue;
  337.     Redraw;
  338.     if Assigned(FOnChangeValue) then
  339.       FOnChangeValue(Self);
  340.   end;
  341. end;
  342.  
  343. procedure TBCLeaLED.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer);
  344. begin
  345.   inherited MouseUp(Button, Shift, X, Y);
  346. end;
  347.  
  348. procedure TBCLeaLED.MouseMove(Shift: TShiftState; X, Y: integer);
  349. begin
  350.   inherited MouseMove(Shift, X, Y);
  351. end;
  352.  
  353. procedure TBCLeaLED.Redraw;
  354. var
  355.   EffectiveSize: integer;
  356.   Blur: TBGRABitmap;
  357.   Mask, Mask2: TBGRABitmap;
  358.   Phong: TPhongShading;
  359.   ScaledPhongSize, ScaledSize: integer;
  360. begin
  361.   FBitmap.SetSize(Width, Height);
  362.   FBitmap.Fill(FBkgColor);
  363.  
  364.   if Width < Height then
  365.     EffectiveSize := Width
  366.   else
  367.     EffectiveSize := Height;
  368.   if EffectiveSize < 2 then exit;
  369.   ScaledSize := Scale96ToForm(FSize);
  370.   ScaledPhongSize := Scale96ToForm(5);
  371.  
  372.   if Enabled then
  373.   begin
  374.     if FValue then
  375.       FBitmap.FillEllipseAntialias((EffectiveSize - 1) / 2, (EffectiveSize - 1) / 2, ScaledSize, ScaledSize, FColorOn)
  376.     else
  377.       FBitmap.FillEllipseAntialias((EffectiveSize - 1) / 2, (EffectiveSize - 1) / 2, ScaledSize, ScaledSize, FColorOff);
  378.   end
  379.   else
  380.     FBitmap.FillEllipseAntialias((EffectiveSize - 1) / 2, (EffectiveSize - 1) / 2, ScaledSize, ScaledSize, clGray);
  381.  
  382.   if (FStyle = zsRaised) or (FStyle = zsLowered) then
  383.   begin
  384.     Mask := FBitmap.FilterGrayscale as TBGRABitmap;
  385.     if (FStyle = zsRaised) then
  386.       Mask.Negative;
  387.     Blur := Mask.FilterBlurRadial(ScaledPhongSize, ScaledPhongSize, rbFast) as TBGRABitmap;
  388.     Blur.FillMask(0, 0, Mask, BGRAPixelTransparent, dmSet);
  389.     Mask.Free;
  390.  
  391.     Phong := TPhongShading.Create;
  392.     if assigned(FTheme) then
  393.     begin
  394.       Phong.AmbientFactor := FAmbientFactor;
  395.       Phong.SpecularIndex := FSpecularIndex;
  396.       Phong.LightDestFactor := FLightDestFactor;
  397.       Phong.LightPosition := Point(FLightPositionX, FLightPositionY);
  398.       Phong.LightPositionZ := FLightPositionZ;
  399.       Phong.LightSourceIntensity := FLightSourceIntensity;
  400.       Phong.LightSourceDistanceTerm := FLightSourceDistanceTerm;
  401.       Phong.LightSourceDistanceFactor := FLightSourceDistanceFactor;
  402.       Phong.NegativeDiffusionFactor := FNegativeDiffusionFactor;
  403.       Phong.SpecularFactor := FSpecularFactor;
  404.       Phong.DiffusionFactor := FDiffusionFactor;
  405.       Phong.DiffuseSaturation := FDiffuseSaturation;
  406.       Phong.LightColor := FLightColor;
  407.     end;
  408.     Phong.Draw(FBitmap, Blur, FAltitude, 0, 0, FBitmap);
  409.     Phong.Free;
  410.     Blur.Free;
  411.  
  412.     Mask := TBGRABitmap.Create(EffectiveSize, EffectiveSize, BGRABlack);
  413.     Mask.FillEllipseAntialias((EffectiveSize - 1) / 2, (EffectiveSize - 1) / 2, ScaledSize, ScaledSize, BGRAWhite);
  414.     Mask2 := TBGRABitmap.Create(EffectiveSize, EffectiveSize, ColorToBGRA(ColorToRGB(FBkgColor)));
  415.     Mask2.PutImage(0, 0, FBitmap, dmSet);
  416.     Mask2.ApplyMask(Mask);
  417.     Mask.Free;
  418.     FBitmap.Fill(FBkgColor);
  419.     FBitmap.PutImage(0, 0, Mask2, dmDrawWithTransparency);
  420.     Mask2.Free;
  421.   end
  422.   else
  423.   begin
  424.     Mask := TBGRABitmap.Create(EffectiveSize, EffectiveSize, BGRABlack);
  425.     Mask.FillEllipseAntialias((EffectiveSize - 1) / 2, (EffectiveSize - 1) / 2, ScaledSize, ScaledSize, BGRAWhite);
  426.     Mask2 := TBGRABitmap.Create(EffectiveSize, EffectiveSize, ColorToBGRA(ColorToRGB(FBkgColor)));
  427.     Mask2.PutImage(0, 0, FBitmap, dmSet);
  428.     Mask2.ApplyMask(Mask);
  429.     Mask.Free;
  430.     FBitmap.Fill(FBkgColor);
  431.     FBitmap.PutImage(0, 0, Mask2, dmDrawWithTransparency);
  432.     Mask2.Free;
  433.   end;
  434.  
  435.   if FValue then
  436.   begin
  437.     Mask := TBGRABitmap.Create(EffectiveSize, EffectiveSize);
  438.     Mask.FillEllipseAntialias((EffectiveSize - 1) / 2, (EffectiveSize - 1) / 2, ScaledSize, ScaledSize, FColorOn);
  439.     Mask := Mask.FilterBlurRadial(ScaledPhongSize * 2, ScaledPhongSize * 2, rbFast);
  440.     FBitmap.BlendImageOver(0, 0, Mask, boGlow);
  441.     Mask.Free;
  442.   end;
  443.  
  444.   FBitmap.Draw(Canvas, 0, 0, True);
  445. end;
  446.  
  447. end.

EDIT: There is an .XML for ...\bgracontrols\fpdoc\bcbutton.xml.
But no information is shown for the corresponding properties.

« Last Edit: March 04, 2025, 01:39:00 pm by CM630 »
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

CM630

  • Hero Member
  • *****
  • Posts: 1615
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Contents of the Information Box for custom components?
« Reply #11 on: July 02, 2025, 09:25:00 am »
It occurs that there is Main Menu — View — FPDoc Editor.
It generates some XMLs.  Maybe this can be used for showing hints.
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

wp

  • Hero Member
  • *****
  • Posts: 13353
Re: Contents of the Information Box for custom components?
« Reply #12 on: July 02, 2025, 11:33:44 am »
I normally have the InfoBox turned off because I want the extra space for properties in the ObjectInspector. Turned it on to verifiy this issue. At first I had trouble seeing the infobox help text, too, but then I found out that I must click on a property in the object inspector, and the corresponding help text will be displayed in the infobox.

The easiest way to generate a help text is to add a comment BEFORE a property declaration in the published section. As an example, I loaded the industrial package and dropped a TLCLDisplay on the form. Some published properties have such a comment, and this text is displayed in the info box when that property is selected in the OI, e.g. "Lines". Other properties do not have such a comment (e.g. DotSize) - in this case only some generic information is displayed. Another example is "AutoSize" which does not have a comment text itself, but since it is an inherited property the text found somewhere higher in the hierarchy is used.

The more complex way is to create xml files for FPDoc. I had exercised that for TAChart and want to repeat this now for the Industrial package: In the package options go to "IDE Integration" and enter a path to the directory for the xml files in the "Search paths" box (the IDE proposes the folder "fpdoc" inside the package directory - that's fine). Then load the unit for which you want to add the xml texts into the IDE and open the FPDoc Editor (from "View" menu).

Then the order of operations is
  • In the source code, click on the identifier to which you want to create the help text. It will be displayed in the header bar of the FPDoc Editor.
  • Click on "Create help item" to create the help item for this identifier - this creates the xml file if it does not exist already and adds an entry for the identifier.
  • Fill in the fields of the FPDoc editor with the information that should be displayed. Items can be formatted by means of the buttons at the left. Note that there are more fields in the tabs of the page control.
I want to add help for the TLCDDisplay and click into its name in the declaration. Then: "Create help item" - oh, there is an error that the path to the xml directory is not valid - well, it does not exist yet. After creating this directory and clicking "Create help item" again, the error is gone, and the lines "Short" and "Link" in the FPDoc Editor are enabled.

In the "Short" box (which is intended to display a short summary of the help on the identifier) I type: "Component simulating a hardware LCD display".

I go to the "Description" tab and type some extended description of the component, etc...

When done, click on the save button at the left. You can immediately test the help text by moving the mouse over the identifier of interest (TLCDDisplay, here) and looking at the yellow popup form.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4675
  • I like bugs.
Re: [ANSWERED] Contents of the Information Box for custom components?
« Reply #13 on: July 02, 2025, 12:30:50 pm »
It does not work for me.
I have also added comments before the declarations of the properties, still the same.
Maybe I shall activate it in some properties of the LPK?
There is a bug in Lazarus 4.0 release. It is fixed in trunk and merged to fixes_4 branch. The next dot release will have the fix.
See:
https://gitlab.com/freepascal.org/lazarus/lazarus/-/commit/59d8be35fd764976
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/14384

The solution is to use build Lazarus from fixes_4 or main branch.

An extra advertisement : ToDoList in Lazarus trunk (main branch) has some nice improvements. Trunk is also very usable most of the time and I recommend it for hobby projects and other experiments.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

paule32

  • Hero Member
  • *****
  • Posts: 645
  • One in all. But, not all in one.
Re: Contents of the Information Box for custom components?
« Reply #14 on: July 02, 2025, 12:48:54 pm »
you can provide help by your self with WebView2
to see: https://github.com/paule32/chmViewer
MS-IIS - Internet Information Server, Apache, PHP/HTML/CSS, MinGW-32/64 MSys2 GNU C/C++ 13 (-stdc++20), FPC 3.2.2
A Friend in need, is a Friend indeed.

 

TinyPortal © 2005-2018