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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:47:47+00:00 2026-06-06T03:47:47+00:00

Seems like i need some help with a project. I have a routine ,

  • 0

Seems like i need some help with a project.
I have a routine , that constructs run time multiple TabItems on to a page control in firemonkey, and i want to have a close button on the tab.
The new tab has a checkbox for the close button loading from the styler of the tabitems.
The page has a default tab, and within some button, i am adding run time the new tab items.
I have managed to apply the event for closing the default tab page, but doesn’t work within the run time created tab pages. Any help would be appreciated.

This is the piece of code for the runtime tabitems

procedure TForm1.Button1Click(Sender: TObject);
var
  t : TTabItem;
  o : TFmxObject;
  i : Integer;
  c : TControl;
begin
  t := TTabItem.Create(pgeControl);

  t.Parent := pgeControl;

  o := FindBinding('imgCloseTabPage');
  if o<>nil then
  begin
    for i := 0 to ComponentCount - 1 do
    begin
      if Components[i] is TCheckBox then
      begin
        TCheckBox(Components[i]).OnClick := CheckBox1Click;
      end;
    end;
  end;

  if pgeControl.TabCount - 1 <= nTab then
  begin
    nTab := nTab + 1;
    t.Index := nTab
  end
  else
  begin
    t.Index := pgeControl.TabCount - 1;
    nTab := pgeControl.TabCount - 1;
  end;
  t.Tag := nTab;

  t.Text := 'Some text...' + ' ' + IntToStr(nTab);
  t.Name := 'tabPatient' + IntToStr(nTab);

  t.Height := 35;
  t.Width := 250;
  t.Margins.Top := 0;
  t.Margins.Left := 0;
  t.Margins.Bottom := 0;
  t.Margins.Right := 0;

  t.Padding.Top := -5;
  t.Padding.Left := 0;
  t.Padding.Bottom := 0;
  t.Padding.Right := 0;

  t.TextAlign := TTextAlign.taLeading;
  t.Width := (Length(t.Text) * 6 ) + 60;
  t.Font.Size := 15;
  t.StyleLookup := 'tabMainStyle1';

  l := TLayout.Create(t);
  l.Parent := t;
  l.Align := TAlignLayout.alClient;
  l.Margins.Top := -5;
  l.Margins.Left := 5;
  l.Margins.Right := 5;
  l.Margins.Bottom := 5;
  l.Padding.Top := 0;
  l.Padding.Left := 0;
  l.Padding.Bottom := 0;
  l.Padding.Right := 0;

  pgeControl.ActiveTab := pgeControl.Tabs[pgeControl.TabCount - 1];
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-06-06T03:47:48+00:00Added an answer on June 6, 2026 at 3:47 am

    You shoud call FindBinding after having applyed the custom style. Currently you call this before, so it can’t find the object. Additionally there was a mistake when you was looking for the object.

    so put this

    o := t.FindBinding('imgCloseTabPage');
    if o<>nil then
    begin
      if o is TCheckBox then
        TCheckBox(o).OnClick := CheckBox1Click;
    end;
    

    after

    t.StyleLookup := 'tabMainStyle1';
    

    and the event should assigned.

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

Sidebar

Related Questions

This seems like it should be something I already know. We need to run
I am writing some applications that require to have a Help Contents system tied
I need a bit of help with some Ruby array jujitsu. I have the
I need to animate the height attribute of iframe, but seems like the animate
I need to create one list based on two other lists. But seems like
I need some clarifications for ASP.NET Membership; please help me with it. I am
I'd like to access the name of a SBT project that uses a plugin
I need some advice as to how to approach a project I am getting
I'm trying to get SBT to build a project that could have more than
Good people - I need some help to find a way to create an

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.