Overview | Methods | Fields | This Package | All Packages
Executes the specified delegate on the thread that created the control's handle and returns when the delegate has completed execution.
public final Object invoke( Delegate method )
public final Object invoke( Delegate method, Object args[] )
Parameters
method
A delegate to a method that takes parameters of the same number and type that are contained in args. The delegate can be an EventHandler object, in which case the sender parameter will contain this control, and the event parameter will contain Event.EMPTY. The delegate can also be a MethodInvoker object or any other delegate that takes a void parameter list. A call to an EventHandler or MethodInvoker delegate is faster than a call to another type of delegate.
args
An array of objects to pass as arguments to the specified method. This can be null if no arguments are needed.
Return Value
Returns the return value of the invoked delegate; returns null if the delegate has no return value.
Exceptions
WFCSystemException thrown if the control's thread is blocked.
Remarks
This method cannot be called if the control's handle hasn't been created yet or if the handle was created on the current thread. There are four functions on a control that are safe to call from any thread: getInvokeRequired, invoke, invokeAsync, and createGraphics. For all other method calls, you should use one of the invokeXXX methods to marshal the call to the control's thread.