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

  • Home
  • SEARCH
  • 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 3288130
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:34:20+00:00 2026-05-17T20:34:20+00:00

I am creating my first custom Delphi component. Its basically a custom Tpanel with

  • 0

I am creating my first custom Delphi component. Its basically a custom Tpanel with header and lines text displayed on it.

I want to be able to add multiple lines text using a stringlist.

When testing the component I cannot get the text lines to display on the panel when adding lines: NewLinesText.add(‘line1 text’)

It does however work when I create and populate a new stringlist at runtime and then assign it to my control : controlPanelitem.NewLinesText = MyNewStringlist

I want to be able to add lines like this: NewLinesText.add(‘line1 text’)

I am using Delphi 7 professional on WinXP. See code below.

Any help would be appreciated!

unit ControlPanelItem; interface uses SysUtils, Classes, Controls, ExtCtrls, Graphics, AdvPanel, StdCtrls, Windows,Forms,Dialogs; type tControlPanelItem = class(TAdvPanel) private fLinesText : TStrings; procedure SetLinesText(const Value: TStrings); procedure SetText; protected public constructor Create(AOwner : TComponent); override; destructor Destroy; override; published property NewLinesText : TStrings read FLinesText write SetLinesText; end; procedure Register; implementation procedure Register; begin RegisterComponents('Samples', [tControlPanelItem]); end; constructor tControlPanelItem.Create(AOwner: TComponent); begin inherited; fLinesText := TStringList.Create; end; destructor tControlPanelItem.Destroy; begin fLinesText.Free; inherited; end; procedure tControlPanelItem.SetLinesText(const Value: TStrings); begin fLinesText.Assign(value); SetText; end; procedure tControlPanelItem.SetText; var count : Integer; begin for count := 0 to fLinesText.Count - 1 do ShowMessage(fLinesText.strings[count]); 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-17T20:34:21+00:00Added an answer on May 17, 2026 at 8:34 pm

    You should do

    procedure SetLines(Lines: TStrings);
    begin
      FLinesText.Assign(Lines);
      // Repaint, update or whatever you need to do.
    end;
    

    You may also need to set the OnChange property of the FLines (do this in the constructor of your custom control, as soon as you have created it). Set it to any TNofifyEvent-compatible (private or protected, I guess) procedure of your component. In this procedure, you can do the repainting, updating etc. you need.

    That is, do

    constructor TControlPanelItem.Create(AOwner: TComponent);
    begin
      inherited;
      FLinesText := TStringList.Create;
      TStringList(FLinesText).OnChange := LinesChanged;
    end;
    
    procedure TControlPanelItem.LinesChanged(Sender: TObject);
    begin
      // Repaint, update or whatever you need to do.
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating my first class, mainly guided by Overland's C++ Without Fear. I've made
I'm creating my first real binary parser (a tiff reader) and have a question
I often refactor code first by creating an inner class inside the class I'm
I'm creating a multi-tenancy web site which hosts pages for clients. The first segment
When loading a page for the first time (!IsPostback), I am creating a button
Creating a patch is very easy in SubVersion, With Tortoise, you right-click and select
Creating hashes of hashes in Ruby allows for convenient two (or more) dimensional lookups.
Creating Traversals for Binary Search Tree with Recursion. void inOrder(void (*inOrderPtr)(T&)) { if(this->left !=
Creating an XPathDocument with referenced DTD sometimes throws a web exception. Why?
When creating a web application, and lets say you have a User object denoting

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.