1
저는 프로그래밍 방식으로 bareries를 만듭니다 (Delphi2007, TeeChar 7 무료 에디션). 내 그래프에 인접 막대를 갖고 싶습니다. 그래서 여러 개의 bareries를 만들고 multibar 속성을 사용하려고합니다.multibar 속성을 통해 액세스 위반이 발생했습니다.
main_unit에서 multibar 속성을 설정할 때 액세스 위반이 발생합니다 (디버깅 할 때 bareries 개체를 검사하면 "바운드 상태가 아닙니다"로 표시됨). bareries가 생성 된 유닛에서 속성을 설정 한 경우에만 오류가 발생하지 않습니다. 외부에서 bareries를 어떻게 조작 할 수 있습니까? unit1에이 목적을 설정해야합니까?
unit unit1
type TMyChart = Class
fchart: TChart;
procedure addSinglebarSeries(var X, Y: integer)
....
implementation
function TSignalchart.addSinglebarSeries(var X, Y: integer): TBarSeries;
j, n : integer;
begin
result := TBarSeries.Create(fChart);
result.AddXY(x,Y,inttostr(x), clRed);
barseries.MultiBar := mbStacked; //here no access violation
end;
----
unit main-unit
implementation
uses TeEngine, TeeProcs, unit1;
procedure myprocedure;
var
newChart : TMyChart;
X, Y := array of integer;
barseries : TBarSeries;
aX, aY, i: integer;
begin
//I create the newchart object, I create X, Y
for i := 0 to length(X) - 1 do
begin
aX := X[i];
aY := Y[i];
barseries := newChart.addsinglebarSeries(aX,aY);
end;
//barseries.MultiBar := mbStacked; //access violation!!
end;
죄송합니다. 델파이 2007입니다. 태그를 편집했습니다. – lib
객체가 선언 된 동일한 단위에서 멀티 바 속성에 액세스하면 액세스 위반이 발생하지 않았기 때문에 질문을 편집했습니다. 이제는 unit1에서 메서드를 편집하겠습니다. – lib