When must I use set/get property?

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

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

When must I use set/get property?

Post 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


User avatar
Posts: 3333
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 252 times
Been thanked: 153 times

Post 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.

User avatar
Posts: 2482
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
Location: Belgium
Has thanked: 775 times
Been thanked: 147 times

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

Post Reply