Page 1 of 1

When must I use set/get property?

Posted: Sat Aug 17, 2019 7:23 pm
by bluebird
Learning Question

If I use a line of code like

Win_1.Button1.enabled:= .F. I may get an error that I can
solve with Setproperty("Win_1","Button1","enabled",.F.)

Please explain the rules for when you must use set/getproperty functions

Thanks

Re: When must I use set/get property?

Posted: Sun Aug 18, 2019 7:33 pm
by mol
When your form Win_1 is known earlier or if you declare Win_1, you can use first statement. If you form Win_1 is loaded/declared/defined in other module (.prg) only SetProperty will work.

Re: When must I use set/get property?

Posted: Fri Aug 23, 2019 4:22 pm
by serge_girard
This reminds me to the following important difference:

Code: Select all

some_form := 'FORM_1'
some_field := 'FIELD_1'

nVAR := GetProperty(some_form, some_field, 'Value')
// or
SetProperty(some_form, some_field, 'Value', nVAR)

/* is impossible with &some_form.&some_field.Value :=  x */