Click or drag to resize

NoMethod Function

X#
Identify an invalid method call.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION NoMethod() AS STRING
Request Example View Source

Return Value

Type: String
A NULL_SYMBOL is returned if such a method does not exist.
Remarks
You can declare a method called NoMethod() for any class which is executed any time a method is invoked that is not defined for that class.
This way you can trap a bad method call before it generates a runtime error.
The NoMethod() function can be called from the NoMethod() method to determine the name of the missing method.
Examples
This example shows the use of NoMethod():
X#
1METHOD NoMethod() CLASS MyDataWindow
2    // This will be called anytime a method that
3    // is called does not exist for MyDataWindow.
4    // This FUNCTION CALL displays the name
5    // of the missing method in the status bar.
6SELF:StatusMessage(Symbol2String(NoMethod()) ;
7    + "method not defined", MESSAGEERROR)
See Also