When must I use set/get property?

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
bluebird
Posts: 167
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF
Has thanked: 49 times
Been thanked: 7 times

When must I use set/get property?

Post by bluebird » Sat Aug 17, 2019 7:23 pm

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

User avatar
mol
Posts: 3214
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 223 times
Been thanked: 123 times
Contact:

Post by mol » Sun Aug 18, 2019 7:33 pm

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.

User avatar
serge_girard
Posts: 2334
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 576 times
Been thanked: 124 times
Contact:

Post by serge_girard » Fri Aug 23, 2019 4:22 pm

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 */

Post Reply