Of course, in my example, it should be
"CASE ISNULL(.role )" not "CASE ISNULL(.type )"
BTW word "type" also sounds good in this case.
>A property of a control should describe the control.
>Your controls on your forms play different roles. Depending of the role of a control you take different actions. So name the role/type of the control and your code will be clear like a full ligth good german beer ;)
>
>PROC Refresh
>#DEFINE EDITABLEDATA 1
>#DEFINE NAVIGATIONAL 2
>#DEFINE SAVECANCEL 3
>#DEFINE OTHER 4
>
>
>WITH This
> DO CASE
> CASE ISNULL(.type)
> * nothing to do
> CASE .Role = EDITABLEDATA
> * set enabled state to the same value of forms editmode
> .Enabled = ThisForm.lEditMode
> CASE .Role = NAVIGATIONAL or .Role = SAVECANCEL
> * set enabled state to the opposite value of forms editmode
> .Enabled = (NOT ThisForm.lEditMode)
>
>
>
>>Hi, folks!
>>
>>Here is a little "competition" <vbg>:
>>
>>I have a class called "MyButton" with a property "xyz"!
>>
>>In the refresh event I put the following code:
>>
>>PROC Refresh
>>WITH This
>> DO CASE
>> CASE ISNULL(.xyz)
>> * nothing to do
>> CASE .xyz = .T.
>> * set enabled state to the same value of forms editmode
>> .Enabled = ThisForm.lEditMode
>> CASE .xyz = .F.
>> * set enabled state to the opposite value of forms editmode
>> .Enabled = (NOT ThisForm.lEditMode)
>>ENDWITH
>>ENDPROC
>>
>>
>>Now the question: What is a good, proper, correct name of the property "xyz"?