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 6907147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:23:57+00:00 2026-05-27T08:23:57+00:00

unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, IdTCPClient;

  • 0
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdTCPClient;

type
  TForm1 = class(TForm)
  procedure FormCreate(Sender: TObject);
  public
    Flist : TList;
    property list : TList read Flist write Flist;
  end;

  Tmy_class = class(TThread)
    public
    procedure test;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure Tmy_class.test;
begin
  // Error here, can't access the Flist var or list propertie, help !! How to access?
  TForm1(TList).list.Clear;

  // Error
  Form1.list.Clear;

  // Error
  Form1.Flist.clear;

  // HOW ????????
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Flist := FList.Create;
end;

end.

How to get access to “Flist” variable ?
Thanks.

Delphi 2010, Indy 10, Win7

Yeap, thats freeking me out:
Your post does not have much context to explain the code sections; please explain your scenario more clearly.

  • 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-27T08:23:58+00:00Added an answer on May 27, 2026 at 8:23 am

    You need to address the variable Form1.

    Form1.list.clear;
    

    But doing this from a thread is not safe.

    Update : compiles fine.

    unit Unit1;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,     Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
    
    type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
     private
        { Private declarations }
        FList : TList;
      public
        { Public declarations }
        property List : TList read FList;
      end;
    
    Type TMyClass = class(TThread)
      Public
        PROCEDURE Test;
    end;
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      FList:= TList.Create;  // Look here how to create the list
    end;
    
    { TMyClass }
    
    procedure TMyClass.Test;
    begin
      Form1.List.Clear;
    end;
    
    end.
    

    But as I warned before, using List directly from a thread is not a good idea.

    See also the comment how to create your list.

    And yes, the TMyClass has to be properly initiated somewhere.

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

Sidebar

Related Questions

unit Unit2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
This is my code: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics,
I'm using Delphi 2006 and psvActiveScript . Example: unit Unit1; interface uses Windows, Messages,
Hi I have a problem with this code: unit Unit1; interface uses Windows, Messages,
unit Unit7; interface uses Classes; type TListener = class(TThread) procedure Execute; override; end; TMyClass
Why will this not compile in Delphi 2009? unit VistaFolders; interface uses Windows, ShellAPI,
What is the difference between: type IFooable = interface IDisposable abstract Foo : (unit
I have put together this code for creating a dynamic form unit Unit1; interface
I want to unit test a RESTful interface written with Apache CXF. I use
Unit testing Abstract classes in Groovy I asked a question previous about unit testing

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.