Difference between revisions of "EventDispatcher:dispatchEvent"

From GiderosMobile
(----)
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
  
 
=== Description ===
 
=== Description ===
Dispatches an event to this [[EventDispatcher]] instance.
+
Dispatches an event to this '''EventDispatcher''' instance.
 
+
<syntaxhighlight lang="lua">
<source lang="lua">
 
 
EventDispatcher:dispatchEvent(event)
 
EventDispatcher:dispatchEvent(event)
</source>
+
</syntaxhighlight>
  
 
=== Parameters ===
 
=== Parameters ===
'''event''': (Event) The [[Event]] object to be dispatched.<br/>
+
'''event''': (Event) the '''Event''' object to be dispatched<br/>
  
----
+
=== Example ===
{{Special:PrefixIndex/EventDispatcher}}
+
<syntaxhighlight lang="lua">
<br/>
+
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>
  
{{Special:PrefixIndex/Event.APPLICATION}}
+
{{EventDispatcher}}
{{Special:PrefixIndex/Event.MEMORY}}
 
{{Special:PrefixIndex/Event.OPEN}}
 
<br/>
 

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