Page 1 of 1

Release objects using macro

Posted: Fri Mar 18, 2011 7:53 am
by raymanw
Hi all,

I can create objects using macro substituion:
@ nRow, 140 LABEL &cGLabel ;

I tried release them using the same but failed. How should I do it?
cGLabel := 'Main.Label_'+AllTrim(Str(nI),1)+'.Release'
&cGLabel

Thanks.

Re: Release objects using macro

Posted: Fri Mar 18, 2011 8:14 am
by gfilatov
raymanw wrote:Hi all,

I can create objects using macro substituion:
@ nRow, 140 LABEL &cGLabel ;

I tried release them using the same but failed. How should I do it?
cGLabel := 'Main.Label_'+AllTrim(Str(nI),1)+'.Release'
&cGLabel
Hi,

Try
cForm := "Main"
cGLabel := "Label_"+AllTrim(Str(nI),1)

DoMethod(cForm, cGLabel, "Release")

Hope that helps :idea:

Re: Release objects using macro

Posted: Fri Mar 18, 2011 9:18 am
by Rathinagiri
Thanks Grigory.

Re: Release objects using macro

Posted: Fri Mar 18, 2011 9:25 am
by raymanw
Hi gfilatov

It worked. Thanks.

Re: Release objects using macro

Posted: Thu Mar 24, 2011 3:52 am
by raymanw
Hi,

How can I use the same to enable/disable an object?

Thanks.

Re: Release objects using macro

Posted: Thu Mar 24, 2011 9:21 am
by mol
I think, you can use Visible property:
SetProperty(cWindowName, cControlName, "VISIBLE", .f.)

Re: Release objects using macro

Posted: Fri Mar 25, 2011 1:41 pm
by raymanw
Hi mol,

Thanks for the solution.