Recent

Author Topic: TCollection.Move not implemented?  (Read 4769 times)

AlexTP

  • Hero Member
  • *****
  • Posts: 2402
    • UVviewsoft
TCollection.Move not implemented?
« on: November 09, 2017, 10:36:36 am »
I can't see TCollection.Move() in fpc 3.0.2, so i must do workaround to change item index: Items[nFrom].Index:= nTo.
Pls publish Move() method.
It exists in TList.
« Last Edit: November 11, 2017, 07:30:30 pm by Alextp »

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: TCollection.Move not implemented?
« Reply #1 on: November 09, 2017, 11:45:18 am »
Which Tlist? Classes? FGL? Generics.collections?
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

AlexTP

  • Hero Member
  • *****
  • Posts: 2402
    • UVviewsoft
Re: TCollection.Move not implemented?
« Reply #2 on: November 09, 2017, 12:54:07 pm »
Classes.TList has Move method.

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: TCollection.Move not implemented?
« Reply #3 on: November 11, 2017, 07:07:10 pm »
Which Tlist? Classes? FGL? Generics.collections?

I was also confused, then I saw the subject name :-)
"TCollection.Move not implemented?"
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

AlexTP

  • Hero Member
  • *****
  • Posts: 2402
    • UVviewsoft
Re: TCollection.Move not implemented?
« Reply #4 on: November 11, 2017, 07:31:00 pm »
Yes, pls implement Move() in TCollection.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: TCollection.Move not implemented?
« Reply #5 on: November 11, 2017, 07:46:06 pm »
What is the problem in calling Collection.Item[ i].Index := new_index? Delphi's TCollection doesn't have it either.

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: TCollection.Move not implemented?
« Reply #6 on: November 11, 2017, 07:54:42 pm »
I see, TCollectionItem.SetIndex call's FPList move().

The only problem I can see is that this is a un-intuitive.  The other lists in the unit have a Move(), so I understand Alextp's issue finding this solution.

I'd recommend slipping this request onto FPC Mantis, preferably with a patch.  The code for Move() should be simply, just set the index.
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

BrunoK

  • Sr. Member
  • ****
  • Posts: 452
  • Retired programmer
Re: TCollection.Move not implemented?
« Reply #7 on: April 10, 2019, 02:02:01 pm »
laz.virtualtrees.pas(8243,122) Error: Wrong number of parameters specified for call to "Move"

FPC issue 0032673, patch 41795 (added move) breaks laz.virtualtrees \components\virtualtreeview\laz.virtualtrees.pas at line
8243 (and others)
Code: Pascal  [Select][+][-]
  1. 8243       Move(FPositionToIndex[OldPosition + 1], FPositionToIndex[OldPosition], (Position - OldPosition) * SizeOf(Cardinal));
  2.  

 

TinyPortal © 2005-2018