Data Access Worldwide Knowledge Base

Article ID 2068
Article Title INFO: Declaring a method "for class" is discouraged
Article URL http://www.dataaccess.com/kbasepublic/kbprint.asp?ArticleID=2068
KBase Category VDF (GENERAL)
Date Created 12/06/2004
Last Edit Date 12/15/2004


Article Text
QUESTION:
I am trying to intercept procedure Mouse_Down for all classes, so I am trying to intercept it at the cUIObject level (which is defined in the Visual DataFlex runtime C code):

Procedure Mouse_Down For cUIObject Integer iWindow Integer iPosition
    Forward Send Mouse_Down iWindow iPosition
    Set PiMyProperty To 0
End_Procedure


ANSWER:
The use of "for class" is discouraged. The "for class" replaces the method at the named class level. So, in the case of cUIObject, you are replacing mouse_down. There is no way you can forward this because there is nowhere to forward this to. The forward would go to cObject, where it is not defined.

The reason we don't recommend this is that:

1) You are changing our class - a class you do not control
2) You are changing runtime C behavior - behavior you cannot see
3) Changing messages defined in C does not work as expected (as it would in DataFlex code)

We use this technique in a couple of places internally because we understand the side effects and we can see the C code.






Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.

The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.