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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:19:13+00:00 2026-05-27T15:19:13+00:00

i have a little problem. I’m trying to create in Delphi7 a list of

  • 0

i have a little problem. I’m trying to create in Delphi7 a list of components at run-time and to resize them with form’s .OnResize event but no use… i can’t figure out how to do it.

Here’s my code:

procedure TForm1.Button1Click(Sender: TObject);
var
  //ExtCtrls
  panel: TPanel;
  memo: TMemo;
  splitter: TSplitter;
  list: TListBox;
begin
  panel := TPanel.Create(Self);
  list := TListBox.Create(Self);
  splitter := TSplitter.Create(Self);
  memo := TMemo.Create(Self);

  with panel do
  begin
    Parent := Form1;
    BevelOuter := bvNone;
    Top := 12;
    Left := 12;
    Height := Form1.Clientheight - 24;
    Width := Form1.Clientwidth - 24;
  end;

  with list do
  begin
    Parent := panel;
    Align := alClient;
    Top := 0;
    Height := panel.Height;
  end;

  with splitter do
  begin
    Parent := panel;
    Top := 0;
    Width := 12;
    Align := alLeft;
  end;

  with memo do
  begin
    Parent := panel;
    Top := 0;
    Left := 0;
    Width := round(panel.Width / 4) * 3;
    Height := panel.Height;
    Align := alLeft;
  end;
end;

Do i have to somehow register their names in order to use them in form’s event? Or maybe, to create a class and include them?

Any kind of help is really appreciated! Thank you in advance.

  • 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-27T15:19:14+00:00Added an answer on May 27, 2026 at 3:19 pm

    Your variables are local to the procedure where they are created so you can’t refer to them using those variables when outside that procedure. The solution is to make them fields of the form class.

    type
      TForm1 = class(TForm)
        procedure FormResize(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      private
        FPanel: TPanel;
        FMemo: TMemo;
        FSplitter: TSplitter;
        FList: TListBox;
      end;
    

    Then your FormResize event handler can refer to them.

    procedure TForm1.FormResize(Sender: TObject);
    begin
      if Assigned(FPanel) then
      begin
        ...
      end;
    end;
    

    Don’t forget to remove the local variables from Button1Click and use the fields instead.

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      FPanel := TPanel.Create(Self);
      ...
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little problem with a simple vbScript. The script has to run
I have a little problem, I don't know how to create the script (with
I have a little problem with Enterprise Architect by Sparx System. Im trying to
I have a little problem understanding the Java language public class PhonebookEntryList extends List<PhonebookEntry>
I have a little problem I am trying to use MartkItUp JQuery rich text
I have a little problem. I wish to create an IF statement, that shall
I have a little problem I spend a lot of time now. I hope
I have a little problem with javascript form submit issue, here is the script
i have little problem with boost::asio library. My app receive and process data asynchronously,
I have a little problem with a Listview. I can load it with listview

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.