by James Bott » Thu Jul 23, 2015 11:29 pm
Vytas,
This syntax is incorrect:
REDEFINE GET oLand_Cover VAR LAND_COVER ID 1009 OF oEdit UPDATE VALID oEdit:oLand_Pos:setColor(CLR_HGRAY, CLR_HGRAY)
It should be something like this:
REDEFINE GET oLand_Cover VAR LAND_COVER ID 1009 OF oEdit UPDATE ;
VALID (oLand_Pos:setColor(CLR_HGRAY, CLR_HGRAY), .t. )
Note that you have to return a logical from a VALID codeblock. Also note that you can't do oEdit:oLand_Pos, but rather just oLand_Pos. All the controls are stored in an array of the dialog object, so the dialog object doesn't have vars matching the names of the vars (such as oEdit:oLand_Pos).
If you want them disabled, you should just do:
REDEFINE GET oLand_Cover VAR LAND_COVER ID 1009 OF oEdit UPDATE ;
VALID (oLand_Pos:disable(), .t. )
Disabling also changes the colors to standard disabled colors, I believe.
However, this is going to get incredibly complex, because you have to also re-enable some GETs if the user goes back and changes the GET or GETs that the disable depends on. For example:
...if GET1=10 .and. GET3="cat" then disable GET5, GET8, and GET9
But if the user then changes either GET1 or GET3, then GET5, GET8, and GET9 have to be re-enabled, and perhaps other GETs have to disabled. Whew!
Just because something can be done, doesn't mean that it should be.
I don't know how complicated your logic plan is, but if it is more than 2 to 3 options, then perhaps you should rethink your design. You could do sequential dialogs like a "wizard." This would be easier to program and less likely to confuse the user.
Regards,
James