Difference between revisions of "EventDispatcher:dispatchEvent"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
+
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
'''Class:''' [[EventDispatcher]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/EventDispatcher|EventDispatcher]]<br/>
+
 
=== <translate>Description</translate> ===
+
=== Description ===
<translate><br />
+
Dispatches an event to this '''EventDispatcher''' instance.
Dispatches an event to this [[Special:MyLanguage/EventDispatcher|EventDispatcher]] instance.<br />
+
<syntaxhighlight lang="lua">
<br /></translate>
+
EventDispatcher:dispatchEvent(event)
<source lang="lua">
+
</syntaxhighlight>
EventDispatcher:dispatchEvent(event)
+
 
</source>
+
=== Parameters ===
=== <translate>Parameters</translate> ===
+
'''event''': (Event) the '''Event''' object to be dispatched<br/>
'''event''': (Event) <translate>The [[Special:MyLanguage/Event|Event]] object to be dispatched.</translate> <br/>
+
 
 +
=== Example ===
 +
<syntaxhighlight lang="lua">
 +
function ButtonTextP9UDDT:onMouseUp(e)
 +
if self.focus and self.isclicked then
 +
local ec = Event.new("clicked")
 +
self:dispatchEvent(ec) -- button was clicked
 +
e:stopPropagation()
 +
end
 +
self.focus = false
 +
self.isclicked = false
 +
self:updateVisualState()
 +
end
 +
</syntaxhighlight>
 +
 
 +
{{EventDispatcher}}

Latest revision as of 14:26, 13 July 2023

Available since: Gideros 2011.6
Class: EventDispatcher

Description

Dispatches an event to this EventDispatcher instance.

EventDispatcher:dispatchEvent(event)

Parameters

event: (Event) the Event object to be dispatched

Example

function ButtonTextP9UDDT:onMouseUp(e)
	if self.focus and self.isclicked then
		local ec = Event.new("clicked")
		self:dispatchEvent(ec) -- button was clicked
		e:stopPropagation()
	end
	self.focus = false
	self.isclicked = false
	self:updateVisualState()
end