Rex.
The method runeventcode should be in the button class. If you have not subclassed the base classes then I am not sure how to do this.
I have a similar situation that I use on my command buttons. I have a property "lActivateBindEvent" on my command buttons that I use to determine the behavior of my command buttons. I check this property in my init code and do the bindevent() only if the property is .t..
Another option if you do not subclass the command button is to create a method on you form that you can code to disable/enable your buttons.
>James,
>
>Thanks for your reply and suggestion.
>
>I am thinking that I should place this in the button init class:
>
>* not tested.
>commandbutton init()
>if type("thisform.ldisablebuttons") = "L"
>bindevent(thisform,"ldisablebuttons",this,runeventcode,1)
>endif
>
>But where do I place this:
>
>procedure runeventcode()
> this.enabled = not thisform.ldisablebuttons
>endproc
>
>I am using the forms designer but I am unsure where the last section goes as I don't seem to be able to create a custom method in the button class. I guess I am not too good with OOP.
>
>BTW, will this turn ALL buttons off then ALL buttons on. This maybe not what i want as some buttons will be enabled and others disabled in the calling form. I was thinking of looping through all buttons to get their state, saving them into an array, then restoring the state on closure of the called form.
>
>What do you think?
>
>Rex
>
>>Rex,
>>
>>You can use bindevent()
>>
>>
>>* not tested.
>>commandbutton init()
>>if type("thisform.ldisablebuttons") = "L"
>>bindevent(thisform,"ldisablebuttons",this,runeventcode,1)
>>endif
>>
>>procedure runeventcode()
>> this.enabled = not thisform.ldisablebuttons
>>endproc
>>
>>
>>
>>then all you have to do is set ldisablebuttons = .t. when calling the form and then .f. when called form is closed.
>>
>>>Regards...Rex