Recent

Author Topic: How it can be possible that TCollection don't have property Count  (Read 1384 times)

nadavvin

  • New Member
  • *
  • Posts: 28
Hello

I'm porting HeiziSQL to Lazarus and somehow TVirtualTreeColumns/TCollection don't have property Count in runtime:
Code: Pascal  [Select][+][-]
  1. List.Header.Columns.Count
  2.  

In the watch list List.Header.Columns is really a TVirtualTreeColumns which derive from TCollection which should have property Count.

Also there is List.Header.Columns.FITEMS which indicate that there is something:
Quote
<TFPLIST> = {
  <TOBJECT> = {
    _vptr$TOBJECT = $c77c28},
  FLIST = $11cf988,
  FCOUNT = 1,
  FCAPACITY = 4,
  CAPACITY = 4,
  COUNT = 1,
  LIST = $11cf988}

So how it possible that there are no COUNT?

Evaluate of List.Header.Columns is:
Quote
<TVIRTUALTREECOLUMNS> = {
  <TCOLLECTION> = {
    <TPERSISTENT> = {
      <TOBJECT> = {
        _vptr$TOBJECT = $df0c38},
      FOBSERVERS = $0},
    FITEMCLASS = $df0fa8,
    FITEMS = $11cf1c8,
    FUPDATECOUNT = 0,
    FNEXTID = 1,
    FPROPNAME = $0,
    UPDATECOUNT = 0,
    ITEMCLASS = $df0fa8},
  FHEADER = $11cf068,
  FHEADERBITMAP = $11cf1f8,
  FHOVERINDEX = -1,
  FDOWNINDEX = -1,
  FTRACKINDEX = -1,
  FCLICKINDEX = -1,
  FCHECKBOXHIT = false,
  FPOSITIONTOINDEX = $11cf9c8,
  FDEFAULTWIDTH = 50,
  FNEEDPOSITIONSFIX = false,
  FCLEARING = false,
  FDRAGINDEX = 0,
  FDROPTARGET = -1,
  FDROPBEFORE = false,
  HEADERBITMAP = $11cf1f8,
  POSITIONTOINDEX = $11cf9c8,
  HOVERINDEX = -1,
  DOWNINDEX = -1,
  CHECKBOXHIT = false,
  CLICKINDEX = -1,
  DEFAULTWIDTH = 50,
  HEADER = $11cf068,
  TRACKINDEX = -1}

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: How it can be possible that TCollection don't have property Count
« Reply #1 on: December 15, 2018, 10:33:45 pm »
TCollection has public property Count, file classesh.inc, line 561, so all descendants have it too.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: How it can be possible that TCollection don't have property Count
« Reply #2 on: December 15, 2018, 10:35:41 pm »
Is your question: "It doesn't have one" (compiler error, when trying to use it) or "you can't see it" (in the debugger)?

http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Properties

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: How it can be possible that TCollection don't have property Count
« Reply #3 on: December 15, 2018, 10:41:46 pm »
TCollection has a Getter function for Count:
Code: Pascal  [Select][+][-]
  1. function TCollection.GetCount: Integer;
  2. begin
  3.   Result:=FItems.Count;
  4. end;

Therefore, you can get the Columns.Count of the VTV in the debugger when you type this in the Evaluate/Modify window:
Code: [Select]
VirtualStringTree1.FHeader.FColumns.FItems.FCount

nadavvin

  • New Member
  • *
  • Posts: 28
Re: How it can be possible that TCollection don't have property Count
« Reply #4 on: December 16, 2018, 12:26:58 am »
You right, thanks!

 

TinyPortal © 2005-2018