Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4054296
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:33:26+00:00 2026-05-20T14:33:26+00:00

Summarization: 1. Manual typecast when debugging, as LachlanG and Ken pointed out. 2. Make

  • 0

Summarization:
1. Manual typecast when debugging, as LachlanG and Ken pointed out.
2. Make use of the concept of Debugger Visualizers introduced since Delphi 2010.
3. Switch to generics counterparts.

=========================================

Take the following code for example:

If breakpoints are set at the end of TestRegular, and at the end of TestGenerics, respectively, one can see the items of the generic list(and even the content of the items) through the debug inspector, but nothing meaningful (not even the count) for the regular tobjectlist, when one hovers the mouse on the tmp variable. I am wondering if there is some way to achieve similar debug-time functionality for regular tobjectlist?

    unit Unit2;

    interface

    uses
      Contnrs, Generics.Collections,
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;

    type
      TMyItem = class;
      TMyItemList = class;
      TForm2 = class;

      TMyItem = class
      private
        fname: string;
      public
        property name: string read fname;
        constructor Create(aName: string);
      end;

      TMyItemList = class(TObjectList)
      protected
        procedure SetObject (Index: Integer; Item: TMyItem);
        function GetObject (Index: Integer): TMyItem;
      public
        function Add (Obj: TMyItem): Integer;
        procedure Insert (Index: Integer; Obj: TMyItem);
        property Objects [Index: Integer]: TMyItem
          read GetObject write SetObject; default;
      end;

      TForm2 = class(TForm)
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
        procedure TestRegular;
        procedure TestGenerics;
      public
        { Public declarations }
      end;

    var
      Form2: TForm2;

    implementation

    {$R *.dfm}

    { TMyItem }

    constructor TMyItem.Create(aName: string);
    begin
      fname := aName;
    end;

    { TMyItemList }

    function TMyItemList.Add(Obj: TMyItem): Integer;
    begin
      Result := inherited Add (Obj);
    end;

    procedure TMyItemList.SetObject(Index: Integer; Item: TMyItem);
    begin
      inherited SetItem (Index, Item);
    end;

    function TMyItemList.GetObject(Index: Integer): TMyItem;
    begin
      Result := inherited GetItem (Index) as TMyItem;
    end;

    procedure TMyItemList.Insert(Index: Integer; Obj: TMyItem);
    begin
      inherited Insert(Index, Obj);
    end;

    {TForm2}

    procedure TForm2.FormCreate(Sender: TObject);
    begin
      TestGenerics;
      TestRegular;
    end;

    procedure TForm2.TestRegular;
    var
     tmp: TMyItemList;
    begin
     tmp := TMyItemList.Create;
     tmp.Add(TMyItem.Create('1'));
     tmp.Add(TMyItem.Create('2'));
     tmp.Free;
    end;

    procedure TForm2.TestGenerics;
    var
     tmp: TObjectList<TMyItem>;
    begin
     tmp := TObjectList<TMyItem>.Create;
     tmp.Add(TMyItem.Create('1'));
     tmp.Add(TMyItem.Create('2'));
     tmp.Free;
    end;

    end.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:33:27+00:00Added an answer on May 20, 2026 at 2:33 pm

    I don’t think you’ll be able to improve what appear in the mouse cursor hover hint.

    You can however use typecasts inside Debug windows just as you can within source code.

    For example you could typecast the tmp variable to TObjectList(tmp) from within the Evaluation Window (Ctrl F7) or create a Watch (Ctrl F5) on the typecasted variable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning to use the NSXMLParser API for the iOS platform and so far

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.