Re: How to move one element of Dynamic Array of Objects
- From: "Rudy Velthuis" <newsgroups@xxxxxxxxxxxx>
- Date: Wed, 26 Mar 2008 12:16:49 +0000 (UTC)
TeChNoInSiDe wrote:
Hi!http://groups.google.com.br/group/comp.lang.pascal.delphi.misc/browse_thread/thread/b2a8c7320a060999/8de55d44c9827f7d?hl=pt-BR&lnk=gst
I read a topic about moving array indexes here:
The real problem is those methods aren´t working for array of objects.
For example:
===================================================
var
TestArray: Array of TAdvGlowButton;
begin
//Clone components
TestArray[0] := TAdvGlowButton component; //component cloned from
original button
TestArray[1] := TAdvGlowButton component; //component cloned from
original button
TestArray[2] := TAdvGlowButton component; //component cloned from
original button
//Delete component at index 1
FreeAndNil(TestArray[1]);
//Move component at index 2 to index 1
for i := 2 to High(TestArray) do
begin
System.Move(TestArray[i], TestArray[(i - 1)], SizeOf(TestArray) *
(Length(TestArray) - (i - 1) - 1));
Why are you doing that in a loop? You only want to do ONE big move, or
move each entry one by one. But not both at the same time.
--
Rudy Velthuis http://rvelthuis.de
"We don't make mistakes, we just have happy little accidents."
-- Bob Ross, "The Joy of Painting"
.
- References:
- How to move one element of Dynamic Array of Objects
- From: TeChNoInSiDe
- How to move one element of Dynamic Array of Objects
- Prev by Date: Re: install delphi 4 and 6 safely on same computer
- Next by Date: Re: install delphi 4 and 6 safely on same computer
- Previous by thread: Re: How to move one element of Dynamic Array of Objects
- Next by thread: Re: How to move one element of Dynamic Array of Objects
- Index(es):