Bonjour à tous

Voilà je suis en train de développer un composant FireMonkey. Il s'agit d'un composant qui affiche une courbe défilante. J'ai souhaité faire ce composant car j'ai besoin d'un affichage rapide et l'utilisation de TChart ne répondait pas au besoin.
Je me suis inspiré de plusieurs tutoriels (https://sjrd.developpez.com/delphi/tutoriel/composants/ et http://docwiki.embarcadero.com/RADSt...osant_existant )

Je suis parvenu à faire une première version de mon composant mais quand je le dépose sur une fiche j'ai systématiquement cette erreur qui s'affiche: Verrou d'objet non possédé

Voici l'entête
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
//---------------------------------------------------------------------------
 
#ifndef GraphicDefilantH
#define GraphicDefilantH
//---------------------------------------------------------------------------
#include <System.SysUtils.hpp>
#include <System.Classes.hpp>
#include <FMX.Controls.hpp>
#include <FMX.Types.hpp>
//---------------------------------------------------------------------------
class PACKAGE TGraphicDefilant : public TStyledControl
{
private:
	String FFormatX;
	String FFormatY;
    void __fastcall SetFormatX(const String Value);
	void __fastcall SetFormatY(const String Value);
protected:
public:
	__fastcall TGraphicDefilant(TComponent* Owner);
    void __fastcall Paint();
__published:
	__property String FormatX = {read = FFormatX, write = SetFormatX};
	__property String FormatY = {read = FFormatY, write = SetFormatY};
};
//---------------------------------------------------------------------------
#endif
et le cpp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
 
// ---------------------------------------------------------------------------
 
#include <fmx.h>
 
#pragma hdrstop
 
#include "GraphicDefilant.h"
#pragma package(smart_init)
// ---------------------------------------------------------------------------
// ValidCtrCheck est utilisée pour garantir que les composants créés n'ont pas
// de fonctions virtuelles pures.
//
 
static inline void ValidCtrCheck(TGraphicDefilant *) {
	new TGraphicDefilant(NULL);
}
 
// ---------------------------------------------------------------------------
__fastcall TGraphicDefilant::TGraphicDefilant(TComponent* Owner)
	: TStyledControl(Owner) {
	FFormatX = "%3.2f";
	FFormatY = "%3.2f";
}
 
// ---------------------------------------------------------------------------
namespace Graphicdefilant {
	void __fastcall PACKAGE Register() {
		TComponentClass classes[1] = {__classid(TGraphicDefilant)};
		RegisterComponents(L"Samples", classes, 0);
	}
}
 
// ---------------------------------------------------------------------------
void __fastcall TGraphicDefilant::Paint() {
	TStyledControl::Paint();
 
	double minY = -1;
	double maxY = 1;
	double minX = 0;
	double maxX = 200;
	TVarRec arga[1] = {(long double)minY};
	String stYmin = Format(FormatY, arga, 0);
	TVarRec argb[1] = {(long double)maxY};
	String stYmax = Format(FormatY, argb, 0);
	TVarRec argc[1] = {(long double)minX};
	String stXmin = Format(FormatX, argc, 0);
	TVarRec argd[1] = {(long double)minY};
	String stXmax = Format(FormatX, argd, 0);
 
	int marge = 4;
 
	Canvas->Fill->Color = claWhite;
	Canvas->FillRect(TRectF(0, 0, Width, Height), 0, 0, AllCorners, 100);
 
	float HXtxt = Canvas->TextHeight(stXmin);
	if (Canvas->TextHeight(stXmax) > HXtxt)
		HXtxt = Canvas->TextHeight(stXmax);
 
	float LYtxt = Canvas->TextWidth(stYmin);
	if (Canvas->TextWidth(stYmax) > LYtxt)
		LYtxt = Canvas->TextWidth(stYmax);
 
	float HYtxt1 = Canvas->TextHeight(stYmax);
	float HYtxt0 = Canvas->TextHeight(stYmin);
	float LXtxt1 = Canvas->TextWidth(stXmax);
	float LXtxt0 = Canvas->TextWidth(stXmin);
 
	float Ay = marge + HYtxt1 / 2;
	float Ax = marge + LYtxt + marge;
	float Ox = Ax;
	float Oy = Height - marge - HXtxt - marge;
	float By = Oy;
	float Bx = Width - marge - LXtxt1 / 2 - marge;
 
	Canvas->Stroke->Color = claBlack;
	Canvas->DrawRect(TRectF(Ax, Ay, Bx, By), 0, 0, AllCorners, 100);
 
	Canvas->Fill->Color = claBlack;
	Canvas->FillText(TRectF(marge, marge, marge + LYtxt, marge + HYtxt1),
		stYmax, false, 1, TFillTextFlags() << TFillTextFlag::RightToLeft,
		TTextAlign::Center, TTextAlign::Center);
	Canvas->FillText(TRectF(marge, Oy - HYtxt0 / 2, marge + LYtxt,
		Oy - HYtxt0 / 2 + HYtxt0), stYmin, false, 1,
		TFillTextFlags() << TFillTextFlag::RightToLeft, TTextAlign::Center,
		TTextAlign::Center);
	Canvas->FillText(TRectF(Ox - LXtxt0 / 2, Oy + marge, Ox + LXtxt0 / 2,
		Oy + marge + HXtxt), stXmin, false, 1,
		TFillTextFlags() << TFillTextFlag::RightToLeft, TTextAlign::Center,
		TTextAlign::Center);
	Canvas->FillText(TRectF(Bx - LXtxt1 / 2, Oy + marge, Bx + LXtxt1 / 2,
		Oy + marge + HXtxt), stXmax, false, 1,
		TFillTextFlags() << TFillTextFlag::RightToLeft, TTextAlign::Center,
		TTextAlign::Center);
	Canvas->EndScene();
}
 
// ---------------------------------------------------------------------------
void __fastcall TGraphicDefilant::SetFormatX(const String Value) {
	FFormatX = Value;
}
 
// ---------------------------------------------------------------------------
void __fastcall TGraphicDefilant::SetFormatY(const String Value) {
	FFormatY = Value;
}
// ---------------------------------------------------------------------------
Une idée d'où ça peut venir?