Tworzenie po kilka razy

0

Mam taki problem

mam zdefiniowane

var
rect :Trect;

begin

end;

teraz muszę stworzyć takich zmiennych np. 6 ja pamiętam, ze to było cos mniejwięcej takiego rect[numer]

Chciałbym zeby to wszystko znalzało się w pętli "for"

jezeli ktos nie kapuje to:

chcę stworzyć takie zmienne (w czasie działania programu)
Rect1
rect2
rect3
rect4
rect5
rect6 :)--

0

var rect: array of TRect; *deklaracja

SetLength(rect, 5); * ustalenie długości

rect[0].Top:=10; * odwołanie do top z 1 recta
rect[1].Top:=10; * odwołanie do top z 2 recta
--Delphi 6
Pozdrowienia{hello} ,
Moderator Imperior

0

hmm wywala mi błąd: Ze cos tam project1.exe wykonał niedozwoloną operację itp.

oto fragment kodu, który robi takie kuku :P

var
i :integer;
left2 : integer;
rect: array of TRect;
begin
if fmouse = true then
begin
SetLength(rect, fmaxitems);
for i:=1 to fmaxitems do
begin
if fcenter = true then *wartości nie globalne :)
begin
left2 := width - fimagelist.Items[selected].width;
rect[i].left := left2 div 2
end else
begin
rect[i].left := 0;
end;
*wartości globalne
rect[i].top := fstart_top + (selected * fseparate) - fseparate;
rect[i].Right := rect[i].left + fimagelist.Items[i].width;
rect[i].Bottom := rect[i].top + fimagelist.Items[i].height;
end;

end else
begin
Showmessage('Error: Mouse is disabled!');
end;
end;

0

juz nie odpowiadajcie wiem co jest źle :)))

left2 := width - fimagelist.Items[selected].width; ma byc

left2 := width - fimagelist.Items[i].width;

hehe--

1 użytkowników online, w tym zalogowanych: 0, gości: 1