dynamically adding components to form

Hi
Does anybody knows how add a new component to form during running program? I would like to add a new array of TPaintBoxes to form. The number of elements of array is giving as parameter of method. Thanks for help

Comments

  • : Hi
    : Does anybody knows how add a new component to form during running program? I would like to add a new array of TPaintBoxes to form. The number of elements of array is giving as parameter of method. Thanks for help
    :
    :
    Hi
    You can dynamically create control using the new operator.
    For example the following code will create a array of TPointBoxes.

    TPaintBox *pPaintBox;
    TPaintBox *arr_PaintBoxes[100];

    pPaintBox=new TPaintBox(this);
    pPaintBox->Parent=this;
    arr_PaintBoxes[0]=pPaintBox;

    The line
    pPaintBox->Parent=this;
    is important.

    Hope this is your required code.



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion