Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.024 c
14-1109746427
Cosinus
2005-03-02 09:53
2005.03.20
Как проверить скорость доступа к сайту?


14-1109824602
begin...end
2005-03-03 07:36
2005.03.20
С Днём рождения! 3 марта


14-1109665646
boriskb
2005-03-01 11:27
2005.03.20
Рекомендуется к прочтению


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


6-1106125547
Чеширский_Кот
2005-01-19 12:05
2005.03.20
Delphi and WAB




   Наверх