Recent

Author Topic: About versions and their installation 4.0, 4.2, 4.4.  (Read 1033 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1271
About versions and their installation 4.0, 4.2, 4.4.
« on: October 02, 2025, 05:48:22 pm »
There was a thread, where WP told me, that a bug in TAChart (the color-setting in Candle chart) will be repaired in version 4.4.

4.4. ist done to about 70 percent
https://gitlab.com/groups/freepascal.org/-/milestones

I have installed 4.0. and love it.
However, the thing with the colour is important to me, it blocks an element's software feature.

Can you pls hint me, what to do:

1) Work on with 4.0 (easy way) and wait for 4.4.

2) Install 4.2. and having some bugs repaired of which I do not suffer too much. The bug I need fixed, is not.

3) Install an experimental version and hope, TA is fixed already (is it?)
(where can I find the version? I would need Win 7, 64 bit)

about installing Lazarus:
I wonder if the installing of any new version means, that I have to re-install all my components from scratch, which is every time a thrilling act, if they will work on (IBX and tvPlanit are two crucial ones)

wp

  • Hero Member
  • *****
  • Posts: 13226
Re: About versions and their installation 4.0, 4.2, 4.4.
« Reply #1 on: October 02, 2025, 06:56:26 pm »
There was a thread, where WP told me, that a bug in TAChart (the color-setting in Candle chart) will be repaired in version 4.4.

4.4. ist done to about 70 percent
https://gitlab.com/groups/freepascal.org/-/milestones
This number is created by GitLab, I don't know how seriously it should be taken.

I have installed 4.0. and love it.
However, the thing with the colour is important to me, it blocks an element's software feature.
Maybe you should try to patch your TAChart manually. The changes for the OHLCSeries were only in a single unit, ta multiseries.pas (in folder components/tachart of your Lazarus installation) (NOTE: The forum software does not allow me to print the unit name here - remove the space after "ta")

I am attaching the patch file as a reference for the following verbal description. It contains several sections, each beginning with "@@" and the line number where the change is to be made - but you must be aware that these line numbers will differ from your v4.0 code by some delta. But there are also unmodified lines from the neighborhood which help to find the places to be changed. Lines beginning with '-' will have to be deleted, and lines beginning with '+' will have to be added.

- At first make a backup copy of your original file so that you can restore it if something goes wrong.
- Find the type declaration of TOHLCBrush in the interface section - delete the entire type.
- Repeat with TOHLCPen.
- Rename TOHLCBrush to TBrush and TOHLCPen to TPen
- In the private section of TOpenHighLowCloseSeries add "const OHLC_BRUSH_COLORS: array[TOHLCBrushKind] of TColor = (clLime, clRed);       OHLC_PEN_COLORS: array[TOHLCPenKind] of TColor = (clGreen, clMaroon, clDefault, clLime, clRed);". The beginning of the type declaration should read now:
Code: Pascal  [Select][+][-]
  1.  TOpenHighLowCloseSeries = class(TBasicPointSeries)
  2.   private  // <-- added
  3.     const  // <-- added
  4.       OHLC_BRUSH_COLORS: array[TOHLCBrushKind] of TColor = (clLime, clRed);   // <-- added
  5.       OHLC_PEN_COLORS: array[TOHLCPenKind] of TColor = (clGreen, clMaroon, clDefault, clLime, clRed);  // <--added
  6.   private
  7.     FPen: array[TOHLCPenKind] of TPen;  // <-- TOHLCPen changed to TPen
  8.     FBrush: array[TOHLCBrushKind] of TBrush;  // <-- TOHLCBrush changed to TBrush
  9.     FTickWidth: Integer;
  10.     FTickWidthStyle: TTickWidthStyle;
  11.     ...
  12.     FMode: TOHLCMode
  13.     function GetBrush(AIndex: TOHLCBrushKind): TBrush;   // <-- TOHLCBrush changed to TBrush
  14.     function GetPen(AIndex: TOHLCPenKind): TPen;  // <-- TOHLCPen changed to TPen
  15.     function IsBrushStored(AIndex: TOHLCBrushKind): Boolean;  // <-- added
  16.     function IsPenStored(AIndex: TOHLCPenKind): Boolean;     // <-- added
  17.     procedure SetBrush(AIndex: TOHLCBrushKind; AValue: TBrush);  // <-- TOHLCBrush changed to TBrush
  18.     procedure SetPen(AIndex: TOHLCPenKind; AValue: TPen);   // <--- TOHLCPen changed to TPen
  19.   ...
  20.   published
  21.     property CandlestickDownBrush: TBrush index obkCandleDown   // <--- TOHLCBrush chanded to TBrush
  22.       read GetBrush write SetBrush stored IsBrushStored;    // <-- added "stored IsBrushStored"
  23.     property CandlestickDownPen: TPen index opkCandleDown  // ... same logic of changes as with CandleStickDownBrush
  24.       read GetPen write SetPen stored IsPenStored;
  25.     property CandlestickLinePen: TPen index opkCandleLine
  26.       read GetPen write SetPen stored IsPenStored;
  27.     property CandlestickUpBrush: TBrush index obkCandleUp
  28.       read GetBrush write SetBrush stored IsBrushStored;
  29.     property CandlestickUpPen: TPen index opkCandleUp
  30.       read GetPen write SetPen stored IsPenStored;
  31.     property DownLinePen: TPen index opkLineDown
  32.       read GetPen write SetPen stored IsPenStored;
  33.     property LinePen: TPen index opkLineUp
  34.       read GetPen write SetPen stored IsPenStored;
  35.     property Mode: TOHLCMode read FMode write SetOHLCMode default mOHLC;  // original line after changes
  36.     ...

- In the implementation section delete the implementation of the TOHLCBrush and TOHLCPen methods
- In TOpenHighLowcloseSeries.Create replace the part following the comment "// Candlestick up brush" by the following lines (up to the "end"):
Code: Pascal  [Select][+][-]
  1.   // Candlestick up brush
  2.   FBrush[obkCandleUp] := TBrush.Create;
  3.   FBrush[obkCandleUp].Color := OHLC_BRUSH_COLORS[obkCandleUp];
  4.   FBrush[obkCandleUp].OnChange := @StyleChanged;
  5.   // Candlestick down brush
  6.   FBrush[obkCandleDown] := TBrush.Create;
  7.   FBrush[obkCandleDown].Color := OHLC_BRUSH_COLORS[obkCandleDown];
  8.   FBrush[obkCandleDown].OnChange := @StyleChanged;
  9.   // Candlestick up border pen
  10.   FPen[opkCandleUp] := TPen.Create;
  11.   FPen[opkCandleUp].Color := OHLC_PEN_COLORS[opkCandleUp];
  12.   FPen[opkCandleUp].OnChange := @StyleChanged;
  13.   // Candlestick down border pen
  14.   FPen[opkCandleDown] := TPen.Create;
  15.   FPen[opkCandleDown].Color := OHLC_PEN_COLORS[opkCandleDown];
  16.   FPen[opkCandleDown].OnChange := @StyleChanged;
  17.   // Candlestick range pen
  18.   FPen[opkCandleLine] := TPen.Create;
  19.   FPen[opkCandleLine].Color := OHLC_PEN_COLORS[opkCandleLine];
  20.   FPen[opkCandleLine].OnChange := @StyleChanged;
  21.   // OHLC up pen
  22.   FPen[opkLineUp] := TPen.Create;
  23.   FPen[opkLineUp].Color := OHLC_PEN_COLORS[opkLineUp];
  24.   FPen[opkLineUp].OnChange := @StyleChanged;
  25.   // OHLC down pen
  26.   FPen[opkLineDown] := TPen.Create; //TOHLCPen.Create;
  27.   FPen[opkLineDown].Color := OHLC_PEN_COLORS[opkLineDown];
  28.   FPen[opkLineDown].OnChange := @StyleChanged;
  29. end;  // <--- unmodified line as a reference

- Find the implementation of TOpenHighLowCloseSeries.GetBrush - replace TOHLCBrush by TBrush ("function TOpenHighLowCloseSeries.GetBrush(AIndex: TOHLCBrushKind): TBrush")
- Likewise with GetPen, SetBrush and SetPen
- Add IsStored functions:
Code: Pascal  [Select][+][-]
  1. function TOpenHighLowCloseSeries.IsBrushStored(AIndex: TOHLCBrushKind): Boolean;
  2. begin
  3.   Result := not (
  4.     (FBrush[AIndex].Color = OHLC_BRUSH_COLORS[AIndex]) and
  5.     (FBrush[AIndex].Style = bsSolid)
  6.   );
  7. end;
  8.  
  9. function TOpenHighLowCloseSeries.IsPenStored(AIndex: TOHLCPenKind): Boolean;
  10. begin
  11.   Result := not (
  12.     (FPen[AIndex].Color = OHLC_PEN_COLORS[AIndex]) and
  13.     FPen[AIndex].Cosmetic and
  14.     (FPen[AIndex].EndCap = pecRound) and
  15.     (FPen[AIndex].JoinStyle = pjsRound) and
  16.     (FPen[AIndex].Mode = pmCopy) and
  17.     (FPen[AIndex].Style = psSolid) and
  18.     (FPen[AIndex].Width = 1)
  19.   );
  20. end;

- Save and recompile the IDE ("Tools" > "Configure Build Lazarus" > in the "Clean-up mode" box check "Clean all" and "Switch to automatic mode after building" > "Build".
- When the IDE rebuild you should have the modified TOpenHighLowCloseSeries.
- If the IDE fails to restarts try to find the error (compare the changes with the diff file that I attach) and repeat to rebuild. If you are not successful and want to give up, restore the saved version of the taohlcsseries.pas unit and rebuild again to get the old Lazarus version back with which you started.


1) Work on with 4.0 (easy way) and wait for 4.4.
That's always an option. But I don't know when v4.4 will be ready, maybe next spring?

2) Install 4.2. and having some bugs repaired of which I do not suffer too much. The bug I need fixed, is not.
Since you are on Windows you can install as many independent Lazarus versions as you like. Just select the "Secondary installation" checkbox in one of the first installer pages. And on the next page define a directory in which that new version will store its settings. Always use a new directory for it, never the one of another already existing installation.

You can also try fpcupdeluxe to create any combination of FPC and Lazarus in an independent way without conflicting with existing installations.

about installing Lazarus:
I wonder if the installing of any new version means, that I have to re-install all my components from scratch, which is every time a thrilling act, if they will work on (IBX and tvPlanit are two crucial ones)
Yes, every new installation is default. 3rdParty components must be reinstalled. But when you get them from OPM they are just a few clicks away, definitely for tvPlanIt which I maintain myself, and IIRC also IBX is fine in the OPM version now).
« Last Edit: October 02, 2025, 07:21:33 pm by wp »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11826
  • Debugger - SynEdit - and more
    • wiki
Re: About versions and their installation 4.0, 4.2, 4.4.
« Reply #2 on: October 02, 2025, 07:24:09 pm »
When you "update" (i.e., install a new version over an existing) then you usually only need to do one rebuild of the IDE to get your installed packages back.
The config, is not changed when you update, and so the rebuild does the reinstallation.

If you upgrade a major version you need of course to ensure any downloaded installed packages are still compatible. For minor upgrades this is very likely the case.

Nicole

  • Hero Member
  • *****
  • Posts: 1271
Re: About versions and their installation 4.0, 4.2, 4.4.
« Reply #3 on: October 02, 2025, 08:48:23 pm »
@WP
Thank so much for having taken time to list the changes.
I tried and I attach my attempt.

Three questions are unclear to me:

1)
Code: Text  [Select][+][-]
  1. Rename TOHLCBrush to TBrush and TOHLCPen to TPen

Aren't they deleted?



2)
Line 196 and 197 stay?


Code: Pascal  [Select][+][-]
  1.   published
  2.     property AxisIndexX;
  3.     property AxisIndexY;
  4.     property MarkPositions;
  5.     property Marks;
  6.     property Source;
  7.   end;
  8.  
  9.   TOHLCBrushKind = (obkCandleUp, obkCandleDown);
  10.   TOHLCPenKind = (opkCandleUp, opkCandleDown, opkCandleLine, opkLineUp, opkLineDown); //  ==> line 196 und 197 stay ?
  11.  
  12. { 2.10.2025 set to comment to patch the unit:
  13.   TOHLCBrush = class(TBrush)
  14.   private
  15.     const
  16.       DEFAULT_COLORS: array[TOHLCBrushKind] of TColor = (clLime, clRed);
  17.   private
  18.     FBrushKind: TOHLCBrushKind;
  19.     function IsColorStored: Boolean;
  20.     procedure SetBrushKind(AValue: TOHLCBrushKind);
  21.   public
  22.     property BrushKind: TOHLCBrushKind read FBrushKind write SetBrushKind;
  23.   published
  24.     property Color stored IsColorStored;
  25.   end;
  26.  



3)

line 2154 ==>  TOHLCPenKind or TPenKind?

Code: Pascal  [Select][+][-]
  1. // procedure TOpenHighLowCloseSeries.SetBrush(AIndex: TOHLCBrushKind; AValue: TOHLCBrush);
  2. procedure TOpenHighLowCloseSeries.SetBrush(AIndex: TOHLCBrushKind; AValue: TBrush);
  3. begin
  4.   if GetBrush(AIndex) = AValue then exit;
  5.   FBrush[AIndex].Assign(AValue);
  6.   UpdateParentChart;
  7. end;
  8.  
  9. //procedure TOpenHighLowCloseSeries.SetPen(AIndex: TOHLCPenKind; AValue: TOHLCPen);
  10.  procedure TOpenHighLowCloseSeries.SetPen(AIndex: TOHLCPenKind; AValue: TPen);
  11. begin
  12.   if GetPen(AIndex) = AValue then exit;
  13.   FPen[AIndex].Assign(AValue);
  14.   UpdateParentChart;
  15. end;
  16.  
  17.  




wp

  • Hero Member
  • *****
  • Posts: 13226
Re: About versions and their installation 4.0, 4.2, 4.4.
« Reply #4 on: October 02, 2025, 09:32:35 pm »
1)
Code: Text  [Select][+][-]
  1. Rename TOHLCBrush to TBrush and TOHLCPen to TPen
Aren't they deleted?
No, Brush and Pen are still needed (they are reponsible for the colors that you requested), but the TOHLBrush/Pen classes were badly designed, ordinary TBrush/TPen are sufficient.

2)
Line 196 and 197 stay?
Code: Pascal  [Select][+][-]
  1.   TOHLCBrushKind = (obkCandleUp, obkCandleDown);
  2.   TOHLCPenKind = (opkCandleUp, opkCandleDown, opkCandleLine, opkLineUp, opkLineDown); //  ==> line 196 und 197 stay ?
  3.  
Yes, the TOHLCBrushKind/TOHLCPenKind now are the indices into the OHLC_*_COLORS arrays of TOpenHighLowCloseSeries.

3)
line 2154 ==>  TOHLCPenKind or TPenKind?

Code: Pascal  [Select][+][-]
  1. // procedure TOpenHighLowCloseSeries.SetBrush(AIndex: TOHLCBrushKind; AValue: TOHLCBrush);
  2. procedure TOpenHighLowCloseSeries.SetBrush(AIndex: TOHLCBrushKind; AValue: TBrush);
  3. ...
TOHLCPenKind, there is no TPenKind. The OHLC prefix was added to indicate that these enumerations are closely related to the OHLCSeries and to avoid naming conflicts if somebody would declare TBrushKind and TPenKind for different purposes.
---------------
The patched unit in your attachment is correct, I tested it in Laz 4.0 and it works fine. Just one tiny thing: In line 2048, a semicolon is missing at the end of the line.
« Last Edit: October 02, 2025, 09:41:25 pm by wp »

Nicole

  • Hero Member
  • *****
  • Posts: 1271
Re: About versions and their installation 4.0, 4.2, 4.4.
« Reply #5 on: October 03, 2025, 03:47:45 pm »
info about version 4.2.:

1) You HAVE to re-install all your components. The "upgrade" keeps the user settings, but not the components. This means, e.g. your user-defined-setting of how to display the componets is kept fine. But e.g. IBX is gone and needs a re-install.

2) At least with version 4.2. the patch for TAChart does not work
Werner said "4.0", but not "4.2".

So I revert my VM to the snapshot with to 4.0. and try again.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11826
  • Debugger - SynEdit - and more
    • wiki
Re: About versions and their installation 4.0, 4.2, 4.4.
« Reply #6 on: October 03, 2025, 04:17:42 pm »
1) You HAVE to re-install all your components. The "upgrade" keeps the user settings, but not the components. This means, e.g. your user-defined-setting of how to display the componets is kept fine. But e.g. IBX is gone and needs a re-install.

Yes, but...

You (should not)  do not have to go to the online package manager, or the "install packages".
You (should) do only have to do "tools > build lazarus with profile ..." and then restart.

- The packages should still be on your disk.
- The info that they ought to be installed is still there
A rebuild should fix that.


On Linux (or on Windows, if you installed to a write protected folder) you may get some oddities when starting your IDE after the new install (using startlazarus). It may still start the old one. Because the system will have a shadow build of the old one. That too, should resolve with a rebuild.

On Linux, I am not sure if you need to change the Lazarus directory in your options => I.e. if the installation path contains the version number, and therefore changed.  (I have no idea, I never used the installer on Linux / always done custom builds).

Nicole

  • Hero Member
  • *****
  • Posts: 1271
Re: About versions and their installation 4.0, 4.2, 4.4.
« Reply #7 on: October 03, 2025, 05:10:10 pm »
Thanks, is saved to my knowledge file for next time.

wp

  • Hero Member
  • *****
  • Posts: 13226
Re: About versions and their installation 4.0, 4.2, 4.4.
« Reply #8 on: October 03, 2025, 11:12:07 pm »
2) At least with version 4.2. the patch for TAChart does not work
Werner said "4.0", but not "4.2".
Why? I only wrote "4.0" because you wrote in your 1st post that this your used version. The patching instruction is working also for v4.2. Moveover, there are no changes in the ta multiseries unit between v4.0 and v4.2, therefore, even the patched file that you sent in reply #3 should be usable in both versions (after fixing the semicolon typo).

Nicole

  • Hero Member
  • *****
  • Posts: 1271
Re: About versions and their installation 4.0, 4.2, 4.4.
« Reply #9 on: October 04, 2025, 09:12:02 am »
I saw some error messages on compiling.
By the reset to a previous version, errors and error messages are gone.
I'll retry next week.
At the moment, I have too many open changes.

However, I have an idea, what may be the reason
The reason is, I am puzzled, because I understood:
- one instruction, "delete the types from the interface" (OHLCPen? and one more)
- a second instruction was "rename them".
- a third hint was, "you need them".

So I restored and renamed them. I bet, this was wrong.

===============

The next clueless thing is,
"just like in my third posting".
I remember long ago postings were numbered, but cannot find such number anywhere any more. So I count the postings and did not find a file attached, as the count seemed for me the correct one.

To sum it up:
I am not sure, which file is the correct one for the patch.
Here the file attempts pile up.


   
« Last Edit: October 04, 2025, 09:14:17 am by Nicole »

wp

  • Hero Member
  • *****
  • Posts: 13226
Re: About versions and their installation 4.0, 4.2, 4.4.
« Reply #10 on: October 04, 2025, 06:29:56 pm »
The next clueless thing is,
"just like in my third posting".
I remember long ago postings were numbered, but cannot find such number anywhere any more. So I count the postings and did not find a file attached, as the count seemed for me the correct one.
See attached screenshot.

I am not sure, which file is the correct one for the patch.
I am attaching the file that you had in "reply #3" (see screenshot to see what this means) and in which I had added the missing semicolon. I works for sure, I just tested compilation and usage in Laz 4.2 an 4.0.
« Last Edit: October 04, 2025, 06:32:01 pm by wp »

Nicole

  • Hero Member
  • *****
  • Posts: 1271
Re: About versions and their installation 4.0, 4.2, 4.4.
« Reply #11 on: October 04, 2025, 08:47:13 pm »
Thank yo so much for both the downloads!
The number was there all the time, but I could not see it.
The years sitting at the screen were not too fine for my eyes.  :(

And THIS WORKS.
Attached is the compare of Gold and Silver. The closer their candles move together, the higher the value of the blue line. If this is the best way to figure it out, the new drawing style will help me find out.

Thanks again.

 

TinyPortal © 2005-2018