![]() |
AppEasy Core SDK
1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
|
Represents a named event with an actions list. More...
#include <CzEvents.h>
Public Attributes | |
unsigned int | EventName |
Event method name as a string hash. | |
unsigned int | ActionsName |
Name of Actions collection as a string hash, to perform when event occurs. | |
CzString | _EventName |
Event method name (e.g. OnResume, OnTapped) | |
CzString | _ActionsName |
Name of Actions collection to perform when event occurs. |
Represents a named event with an actions list.
An event is something that occurs in your app that you may or may not want to know about and act upon. For example, when the scene is first created the OnCreate event is raised. Using actions (explained in CzAction) you can react to these events and modify your apps behaviour.
CzEvent binds a named event with an actions list that will be called when the event takes place. All classes that benefit from receiving events from XOML contain a CzEventManager which handles the binding of named events to actions lists. Lets take a look at q quick XOML example:
<Label Position="-200, 0" Size="150, 75" Font="serif" Background="Button1Brush" Text="Rock" OnTapped="Selected"> <Actions Name="Selected"> <Action Method="SetVar" Param1="Selected" Param2="0"/> <Action Method="ChangeProgram" Param1="Main" Param2="start"/> </Actions> </Label>
In the above example we create a label actor that handles the OnTapped event. When the user taps this label actor it will raise the OnTapped event from CzActor::NotifyTapped) by calling ProcessEventActions(CzHashes::OnTapped_Hash). CzActor::ProcessEventActions() will search the actors events list to see if it is subsribed to the OnTapped event in XOML and if it is then the asociated actions list will be called. In the above example it has the "Selected" actions list mapped to the OnTapped event so this will be called.
Note that any class that can raise an OnXXXX event implements a method to raise the event called NotifyXXXX.
Name of Actions collection to perform when event occurs.
Event method name (e.g. OnResume, OnTapped)
unsigned int CzEvent::ActionsName |
Name of Actions collection as a string hash, to perform when event occurs.
unsigned int CzEvent::EventName |
Event method name as a string hash.