Page 1 of 1

Dynamic pagecontrol tab item control

PostPosted: August 23rd, 2010, 9:40 am
by Xslammer
Hi all.

I have a pageControl on my page in which im adding its tabs dynamically.When adding the page control tabs i also add textboes and memos to it. so my problem now is how to add some text to a specific tab textbox, since everything within the tab has been added dynamic , i know how to find the tab on which i wanna alter changes to but i dont know how to make the changes to a textbox withing a specific tab dynamic. since wat i do is check the tab titles in my page to know the tab index of the tab which i wanna change its textbox text or memo text from the i dont know how to change d text in the textbox of that tab. Well i dont knw if i explained well but i hope someone gets wat im trying to accomplish.

Re: Dynamic pagecontrol tab item control

PostPosted: August 25th, 2010, 10:48 am
by SaeedShekari
I have no idea what you are doing, but check these ways, hope these can help.

1) Simply behave the Editbox as usual :
If the component is a TEditBox > MyEditBox.Text:= ‘Hi all’;
Or if it is a TMemo > With MyMemo.Lines do Begin ………… End;

2) Or try below function (you have to edit it to suit your inquiries)
Code: Select all
Procedure ChangeMyComponent(Cont: TWinControl);
Var
  i: Integer;
begin
  For i:= 0 To Cont.ControlCount - 1 Do
  Begin
    If (Cont.Controls[i] Is TGroupBox) And (TGroupBox(Cont.Controls[i]).ControlCount > 0) Then
      SetControlsEn_Disabled(TWinControl(Cont.Controls[i]))
    Else
    Begin
      If Cont.Controls[i] Is TTextEdit Then
      With TTextEdit(Cont.Controls[i]) Do
      Begin
        //Do what you want
      End;
    End;
  End;
End;
//To Call tis function
// ChangeMyComponent(MyTabPage);