EventDispatcher:dispatchEvent: Difference between revisions
From GiderosMobile
No edit summary |
No edit summary |
||
| (7 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
'''Available since:''' Gideros 2011.6<br/> | |||
''' | '''Class:''' [[EventDispatcher]]<br/> | ||
''' | |||
=== | === Description === | ||
Dispatches an event to this '''EventDispatcher''' instance. | |||
Dispatches an event to this | <syntaxhighlight lang="lua"> | ||
EventDispatcher:dispatchEvent(event) | |||
< | </syntaxhighlight> | ||
</ | === Parameters === | ||
=== | '''event''': (Event) the '''Event''' object to be dispatched<br/> | ||
'''event''': (Event) | |||
=== Example === | |||
<syntaxhighlight lang="lua"> | |||
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 | |||
</syntaxhighlight> | |||
{{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