Skip to main content
Version: 9.0.2

gre.send_event_target

gre.send_event_target(
event_name,
target,
[channel]
)

Send an event to a targeted model element (control, layer instance or screen) using the model's fully qualified path. The channel is an optional parameter.

Parameters

ParameterTypeDescription
event_name#stringA string containing the event to send.
target#stringA string containing the object to target the event to (see Storyboard IO).
channel#string[Optional] Storyboard IO channel to send the event on, if not specified the event is added directly into the current Storyboard application event queue if neither the environment variable or global GREIONAME variable are set.

Returns

TypeDescription
#booleantrue for success, false for failure and error message string, e.g. "Can't open greio channel my_channel".

Example

-- Send an event directed at a particular control target:
gre.send_event_target("my_event", "my_layer.my_control")


-- Send an event directed at a particular control on the channel
-- "io_channel_name" and grab the status of the operation

local success, error = gre.send_event_target("my_event",
"my_layer.my_control", "io_channel_name")
if(success == false) then
print(error)
--handle error
end