RaiseEvent Function | |
-- todo --
You can use RaiseEvent( ) to raise, or trigger, an event from a custom method. Though RaiseEvent( ) applies primarily to
custom methods, you can use it for raising native events and methods.
Namespace:
XSharp.VFP
Assembly:
XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax FUNCTION RaiseEvent(
oEventSource,
cEvent,
_args
) AS LOGIC CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public static bool RaiseEvent(
Usual oEventSource = default,
Usual cEvent = default,
Usual _args = default
)
Request Example
View SourceParameters
- oEventSource (Optional)
- Type: Usual
Specifies the event source, which must be a valid X# object.
- cEvent (Optional)
- Type: Usual
Specifies the name of the event, method, or property you want to raise.
- _args (Optional)
- Type: Usual
Return Value
Type:
Logic
Logical data type.
RaiseEvent( ) always returns True (.T.).
Remarks
X# automatically raises events for custom methods that are bound to objects using
BINDEVENT( ) if the methods are called directly.
For example, the following code does not raise an event:
Instead, to raise an event for a custom method, you need to make the following call:
1RaiseEvent( oForm, "GetMyData", cData )
You can also change this behavior by using
BINDEVENT( ) with nFlags set to 2 or 3.
The event you wish to raise must be marked
Public, not
Hidden or
Protected.
If you use
RaiseEvent( ) on a property, X# sets the property to itself.
The following example sets the
Caption property for
_SCREEN to the current value for
Caption:
1RaiseEvent( _SCREEN, "Caption" )
Raising an event fails if you bind to an event, for example, using
BINDEVENT( ), that has parameters that are passed by reference.
X# disregards recursive
RaiseEvent( )calls to an event from within the same raised event.
Examples 1RaiseEvent( Form1, "Activate" )
See Also