Recent

Author Topic: [Solved] Reference to bsSolid gives identifier not found  (Read 513 times)

Wilko500

  • Full Member
  • ***
  • Posts: 180
[Solved] Reference to bsSolid gives identifier not found
« on: July 09, 2025, 02:28:57 pm »
Laz 4.1 FPC 3.2.2 running on macOS Sequoia
My test Chart program works, all defined in Form1/unit1.  I wanted to gather together all the code used by my Chart procedures into a separate unit, U_EnergyHarvest.  This line resulted in bsSolid identifier not found
Code: Pascal  [Select][+][-]
  1. Form1.Chart1AreaSeries1.AreaBrush.Style:=bsSolid;  
I was able to fix this by adding FPCanvas (took a while to find this :)) to my new units implementation but this was not included in unit1 where the chart was originally defined.

Code: Pascal  [Select][+][-]
  1. implementation
  2. uses
  3.   Unit1, TAGraph, TASeries, TAIntervalSources, TAStyles, FPCanvas, u_aurora, DateUtils;
This is the original uses from unit1
Code: Pascal  [Select][+][-]
  1. uses
  2.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
  3.   RichMemo, TAGraph, TASeries, TAIntervalSources, TAStyles, MyUtils, DateUtils,
  4.   u_aurora, U_EnergyHarvest;
Please might someone explain why an explicit FPCanvas was needed when code was running from a second unit. 

Ok. I think I solved it. I just discovered that adding Graphics instead of FPCanvas works as well and Graphics was in the original uses, but I don't recall why I added it.  Maybe a requirement of TChart??
« Last Edit: July 09, 2025, 11:15:34 pm by Wilko500 »
MacBook Pro mid 2015 with OS Monterey 12.7.6
FPC 3.2.3 Lazarus 3.7
FPC 3.2.2 Lazarus 3.4

wp

  • Hero Member
  • *****
  • Posts: 13433
Re: Reference to bsSolid gives identifier not found
« Reply #1 on: July 09, 2025, 03:09:17 pm »
Graphics is one of the most elemental LCL units, it is added to the uses clause for every form unit by default ("form unit" = unit linked to an lfm form). But when you add a new stand-alone unit to the project there are only Classes and SysUtils in the uses clause.

Wilko500

  • Full Member
  • ***
  • Posts: 180
Re: Reference to bsSolid gives identifier not found
« Reply #2 on: July 09, 2025, 11:15:03 pm »
Thank you for confirming that. When I think of the number of new applications I have created and I never noticed that Graphics was always there.

PS: I have been reading number of your posts on labelling chart axis and have found them very helpful, thank you.   I will soon have a much more challenging question on that very subject.
MacBook Pro mid 2015 with OS Monterey 12.7.6
FPC 3.2.3 Lazarus 3.7
FPC 3.2.2 Lazarus 3.4

 

TinyPortal © 2005-2018