Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Destroy Panel Run Time
Mon, Mar 14 2016 7:17 AMPermanent Link

Pasquale

Web Pos srl

How do i check if there is a TPanel create at RUN-TIME ?

How I do DESTROY this TPanel ?
Mon, Mar 14 2016 7:34 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

The "Free" method will destroy most objects.

To identify the runtime ones over design time ones, you can either use the "tag" property on the panel (setting it to, for example, 1 if it's a runtime creation), or else you could keep your own TObject array.

Then you could loop over either your own object array or the form's Component list (to pull out the ones with a tag=1).

Hope that makes sense.
Mon, Mar 14 2016 7:40 AMPermanent Link

Pasquale

Web Pos srl

How do I point the object (ricaricheonline named) if I create a RUN-TIME ?

If i write

ricaricheonline.free

the compiler generate error .





squiffy wrote:

The "Free" method will destroy most objects.

To identify the runtime ones over design time ones, you can either use the "tag" property on the panel (setting it to, for example, 1 if it's a runtime creation), or else you could keep your own TObject array.

Then you could loop over either your own object array or the form's Component list (to pull out the ones with a tag=1).

Hope that makes sense.
Mon, Mar 14 2016 7:44 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

(posted this in answer to your other question - should have been here )

You would either need to create a tobject array and loop through to find the object you require, or you can loop through the form's Component array - again this is pseudocode as I can't test right now :

for i := 0 to Form1.ComponentCount - 1 do
begin
 if (Component[i] is TPanel) then
    if Component[i].Tag = 1 then
         Component[i].Free;

end;

Might not be 100% correct but it shows the principle.
You could further check to see if it's name is the one you are looking for.

There are examples of TObject Array in the docs.
Mon, Mar 14 2016 8:25 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Pasquale,

<< the compiler generate error . >>

Please post the error message.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Mar 14 2016 8:46 AMPermanent Link

Matthew Jones

Pasquale wrote:

> How do i check if there is a TPanel create at RUN-TIME ?
>
> How I do DESTROY this TPanel ?

You might like to read my post at
http://matthew-jones.com/making-a-prettier-grid-in-elevate-webbuilder/
where I do this, and keep objects with references to the components for
access.

--

Matthew Jones
Mon, Mar 14 2016 8:56 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

One other thing - because you're playing with the created object you might find it slightly easier if you do this :

Instead of creating the object on the "with" line, assign the newly created object to a variable, then use that in the "with"
Image