Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.03.20;
Скачать: CL | DM;

Вниз

Динамическое создание объектов в glscene   Найти похожие ветки 

 
Goldseeker   (2004-12-24 21:01) [0]

почему этот код не работает, причем дает ошибку лишь при повторном нажатии кнопки:
procedure TForm1.Button1Click(Sender: TObject);
begin
setlength(sphere,length(sphere)+1);
sphere[length(sphere)]:=msphere(gldummycube1.AddNewChild(msphere)) ;
sphere[length(sphere)].Position.x:=random(2);
sphere[length(sphere)].Position.y:=random(2);
sphere[length(sphere)].Position.z:=random(2);
end;
sphere - динамический массив msphere
msphere - класс потомок tglsphere


 
kerby   (2004-12-27 09:39) [1]

паскальчик учить надо

переменные:
sphere:array of tglsphere;
count:integer;

инициализация:
count:=0;
setlength(sphere,count);

обработчик:
inc(count);

SetLength(sphere,count);
sphere[count-1]:=TGLSphere(GLDummyCube1.AddNewChild(TGLSphere));
      ^^^^^^^^
with sphere[count-1] do
           ^^^^^^^^
begin
Position.SetPoint(random(5),random(5),random(5));
end;



Страницы: 1 вся ветка

Текущий архив: 2005.03.20;
Скачать: CL | DM;

Наверх




Память: 0.46 MB
Время: 0.028 c
1-1109945501
andrey__
2005-03-04 17:11
2005.03.20
TDBGrid - свойство FixedCols


1-1109935767
Gek1
2005-03-04 14:29
2005.03.20
Реестр


3-1108932186
VitGun
2005-02-20 23:43
2005.03.20
Формы Excel -> FastReport


14-1109863401
Dann
2005-03-03 18:23
2005.03.20
Forward declarations in Cpp


9-1101714129
Вась-Вась
2004-11-29 10:42
2005.03.20
Win API