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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:29:01+00:00 2026-05-15T11:29:01+00:00

On a form I put down 1 x TCategoryPanelGroup object and added 3 TCategoryPanel

  • 0

On a form I put down 1 x TCategoryPanelGroup object and added 3 TCategoryPanel to it. In a routine, I need to go through each of TCategoryPanel and through each object onto those panel to produce an output.

So, here is the code … why into the second FOR instead of giving me classname of each component (i.e. TButton, TLabel, etc) it gives out a TCategoryPanelSurface?

Short question: How can I access each controls from each TCategoryPanel?


procedure TForm1.Button2Click(Sender: TObject);
    var i,i2 : integer;

    begin
      for i := 0 to CategoryPanelGroup1.ControlCount-1 do
      begin
        showMessage((CategoryPanelGroup1.Controls[i] as TCategoryPanel).caption ) ;

        for i2 := 0 to (CategoryPanelGroup1.Controls[i] as TCategoryPanel).ControlCount-1 do
        begin

          showMessage((CategoryPanelGroup1.Controls[i] as TCategoryPanel).Controls[i2].ClassName);
        end;
      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-15T11:29:02+00:00Added an answer on May 15, 2026 at 11:29 am

    You are looping through the Group’s underlying TWinControl.Controls[] list when you should be looping through its TCategoryPanelGroup.Panels list instead.

    As for why you are seeing a TCategoryPanelSurface appear, TCategoryPanel creates that object as a direct child of itself in its constructor. Any control you place into the Panel afterwards is actually a child of that TCategoryPanelSurface object, not a child of the TCategoryPanel itself. That is why your looping never sees those controls.

    Unfortunately, TCategoryPanel does not expose direct access to its TCategoryPanelSurface object. So, in order to loop through its children, you have to first be able to access it. There are two possible ways to do that:

    1)

    procedure TForm1.Button2Click(Sender: TObject);
    var
      i, j: integer;
      panel: TCategoryPanel;
      surface: TCategoryPanelSurface;
    begin
      for i := 0 to CategoryPanelGroup1.Panels.Count-1 do
      begin
        panel := TCategoryPanel(CategoryPanelGroup1.Panels[i]);
        ShowMessage(panel.Caption);
        surface := panel.Controls[0] as TCategoryPanelSurface;
        for j := 0 to surface.ControlCount-1 do
        begin
          ShowMessage(surface.Controls[j].ClassName);
        end;
      end; 
    end; 
    

    2)

    type
      TCategoryPanelAccess = class(TCategoryPanelAccess)
      end;
    
    procedure TForm1.Button2Click(Sender: TObject);
    var
      i, j: integer;
      panel: TCategoryPanel;
      surface: TCategoryPanelSurface;
    begin
      for i := 0 to CategoryPanelGroup1.Panels.Count-1 do
      begin
        panel := TCategoryPanel(CategoryPanelGroup1.Panels[i]);
        ShowMessage(panel.Caption);
        surface := TCategoryPanelAccess(panel).FPanelSurface;
        for j := 0 to surface.ControlCount-1 do
        begin
          ShowMessage(surface.Controls[j].ClassName);
        end;
      end; 
    end; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to put on a form 3 buttons and when I click on
Rep steps: create example .NET form application put a TextBox on the form wire
I want to insert a group box in the form and put in 3
If I want to put a form up on SharePoint, is it easier to
Imagine a user that would like to put a form on their website that
I've put together a simple form to highlight the concepts of dynamic forms. What
Where do you put user input validation in a web form application? View: JavaScript
I found that SO put the search input inside a form tag, and i
In a recent project I put a captcha test on a login form, in
I am making a form with Django, and need to manually lay out the

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.