EventDispatcher:dispatchEvent: Difference between revisions

From GiderosMobile
m Text replacement - "<source" to "<syntaxhighlight"
No edit summary
 
(One intermediate revision by one other user not shown)
Line 6: Line 6:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
EventDispatcher:dispatchEvent(event)
EventDispatcher:dispatchEvent(event)
</source>
</syntaxhighlight>


=== Parameters ===
=== Parameters ===
Line 16: Line 16:
if self.focus and self.isclicked then
if self.focus and self.isclicked then
local ec = Event.new("clicked")
local ec = Event.new("clicked")
ec.info1 = "Hello, "
ec.info2 = "World!"
self:dispatchEvent(ec) -- button was clicked
self:dispatchEvent(ec) -- button was clicked
e:stopPropagation()
e:stopPropagation()
Line 23: Line 25:
self:updateVisualState()
self:updateVisualState()
end
end
</source>
</syntaxhighlight>


{{EventDispatcher}}
{{EventDispatcher}}

Latest revision as of 01:09, 7 December 2025

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")
		ec.info1 = "Hello, "
		ec.info2 = "World!"
		self:dispatchEvent(ec) -- button was clicked
		e:stopPropagation()
	end
	self.focus = false
	self.isclicked = false
	self:updateVisualState()
end