Properties | List of all members
MessageTrigger Interface Reference

Configure where and which trigger messages are handled. More...

Inheritance diagram for MessageTrigger:
Trigger

Properties

MessageProperty MessageProperty [get]
 Gets the message property type. More...
 
Node MessageSource [get, set]
 Gets or sets the target item from which to intercept messages. More...
 
NodeReference< Node > RelativeMessageSource [get, set]
 
MessageRoutingModeEnum RoutingMode [get, set]
 Gets or sets the message routing mode: More...
 
bool SetHandled [get, set]
 Gets or sets the message handling mode: More...
 
- Properties inherited from Trigger
IEnumerable< Action > Actions [get]
 Gets the actions in a trigger. More...
 
IEnumerable< TriggerConditionConditions [get]
 Gets the conditions in a trigger. More...
 
TriggerProperty TriggerProperty [get]
 Gets the type of the trigger. More...
 

Additional Inherited Members

- Public Member Functions inherited from Trigger
Action CreateAction (ActionProperty actionProperty)
 Creates a trigger action. More...
 
MessageAction CreateAction (MessageProperty actionProperty, string routingTargetRelativePath)
 Creates a message action and specifies a relative path to the target item to which the message will be dispatched. More...
 
MessageAction CreateAction (MessageProperty actionProperty, ProjectItem routingTarget)
 Creates a message action and specifies the target item to which the message will be dispatched. More...
 
MessageAction CreateAction (MessageProperty actionProperty, ProjectItemReference< ExportedPropertyContainerItem > routingTargetReference)
 Creates a message action and specifies a reference to the target item to which the message will be dispatched. More...
 
MessageAction CreateAction (MessageProperty actionProperty, ProjectItemReference< ExportedPropertyContainerItem > routingTargetReference, uint delay)
 Creates a message action. More...
 
Action CreateAction (Action sourceAction)
 Creates a trigger action by copying an existing action. More...
 
MessageAction CreateAction (MessageAction sourceAction)
 Creates a message action by copying an existing action. More...
 
TriggerCondition CreateCondition ()
 Adds a condition under which Kanzi sets off a trigger. More...
 
TriggerCondition CreateCondition (TriggerCondition sourceCondition)
 Adds a trigger condition by copying an existing condition. More...
 
bool DeleteAction (Action action)
 Deletes an action. More...
 
bool DeleteCondition (TriggerCondition condition)
 Deletes a trigger condition. More...
 

Detailed Description

Configure where and which trigger messages are handled.

Messages are used to communicate between nodes in the scene graph. The messages travel between nodes using a process called tunneling and bubbling. The message achieves its target node during tunneling and then starts to travel from child to parent during bubbling until a trigger is intercepted and the message set as handled (consumed). You can thus place triggers in ancestors as well as the controls themselves. For example, you can place a trigger called radioButtonHandler to the parent of multiple buttons.

See also
NodeComponentHost, Trigger

Property Documentation

MessageProperty MessageProperty
get

Gets the message property type.

Node MessageSource
getset

Gets or sets the target item from which to intercept messages.

Use either MessageSource or RelativeMessageSource to set the specific target item from which to intercept messages.

See also
RelativeMessageSource

Examples

To create a trigger and set the target item from which the trigger intercepts messages:

public void Execute(PluginCommandParameter parameter)
{
// Get the RootPage node in the Screens/Screen node.
var rootPage = studio.Project.GetProjectItem("Screens/Screen").GetChild<Page>("RootPage");
// Create a Toggle Button Group 2D node in the RootPage node.
var toggleButtonGroup = studio.Project.CreateProjectItem<ToggleButtonGroup2D>(
rootPage.GenerateUniqueChildName("Toggle Button Group 2D"),
rootPage);
// Create a Stack Layout 2D node in the Toggle Button Group 2D node.
var stackLayout = studio.Project.CreateProjectItem<StackLayout2D>("Stack Layout 2D", toggleButtonGroup);
// Create two Toggle Button 2D nodes in the Toggle Button Group 2D node.
var toggleButton1 = studio.Project.CreateProjectItem<ToggleButton2D>("Toggle Button 1", stackLayout);
studio.Project.CreateProjectItem<ToggleButton2D>("Toggle Button 2", stackLayout);
// Create an Toggle Button Group: Toggled trigger in the Toggle Button Group 2D node.
var toggledTrigger = toggleButtonGroup.CreateTrigger(Properties.MessageToggleButtonGroupConceptToggled);
// To set the Toggle Button Group: Toggled trigger to intercept messages only from Toggle Button 1,
// set the Message Source of the Toggle Button Group: Toggled trigger to Toggle Button 1.
toggledTrigger.MessageSource = toggleButton1;
}
NodeReference<Node> RelativeMessageSource
getset

Gets or sets the relative path to the target item from which to intercept messages:

  • Reference to the target item to intercept messages from a specific target item
  • Null to intercept messages from all sources

Use either RelativeMessageSource or MessageSource to set the specific target item from which to intercept messages.

See also
MessageSource

Examples

To create a trigger and set the relative target item from which the trigger intercepts messages:

public void Execute(PluginCommandParameter parameter)
{
// Get the RootPage node in the Screens/Screen node.
var rootPage = studio.Project.GetProjectItem("Screens/Screen").GetChild<Page>("RootPage");
// Create a Toggle Button Group 2D node in the RootPage node.
var toggleButtonGroup = studio.Project.CreateProjectItem<ToggleButtonGroup2D>(
rootPage.GenerateUniqueChildName("Toggle Button Group 2D"),
rootPage);
// Create a Stack Layout 2D node in the Toggle Button Group 2D node.
var stackLayout = studio.Project.CreateProjectItem<StackLayout2D>("Stack Layout 2D", toggleButtonGroup);
// Create two Toggle Button 2D nodes in the Toggle Button Group 2D node.
studio.Project.CreateProjectItem<ToggleButton2D>("Toggle Button 1", stackLayout);
studio.Project.CreateProjectItem<ToggleButton2D>("Toggle Button 2", stackLayout);
// Create an Toggle Button Group: Toggled trigger in the Toggle Button Group 2D node.
var toggledTrigger = toggleButtonGroup.CreateTrigger(Properties.MessageToggleButtonGroupConceptToggled);
// Create a reference to the Toggle Button 1 node.
NodeReference<Node> relativeMessageSource = new NodeReference<Node>("Stack Layout 2D/Toggle Button 1");
// To set the Toggle Button Group: Toggled trigger to intercept messages only from Toggle Button 1,
// set the Relative Message Source of the Toggle Button Group: Toggled trigger to Toggle Button 1.
toggledTrigger.RelativeMessageSource = relativeMessageSource;
}

To create a trigger and set it to intercept messages from all sources:

public void Execute(PluginCommandParameter parameter)
{
// Get the RootPage node in the Screens/Screen node.
var rootPage = studio.Project.GetProjectItem("Screens/Screen").GetChild<Page>("RootPage");
// Create a Toggle Button Group 2D node in the RootPage node.
var toggleButtonGroup = studio.Project.CreateProjectItem<ToggleButtonGroup2D>(
rootPage.GenerateUniqueChildName("Toggle Button Group 2D"),
rootPage);
// Create a Stack Layout 2D node in the Toggle Button Group 2D node.
var stackLayout = studio.Project.CreateProjectItem<StackLayout2D>("Stack Layout 2D", toggleButtonGroup);
// Create two Toggle Button 2D nodes in the Toggle Button Group 2D node.
studio.Project.CreateProjectItem<ToggleButton2D>("Toggle Button 1", stackLayout);
studio.Project.CreateProjectItem<ToggleButton2D>("Toggle Button 2", stackLayout);
// Create an Toggle Button Group: Toggled trigger in the Toggle Button Group 2D node.
var toggledTrigger = toggleButtonGroup.CreateTrigger(Properties.MessageToggleButtonGroupConceptToggled);
// To set the Toggle Button Group: Toggled trigger to intercept messages from all sources,
// set the Relative Message Source of the Toggle Button Group: Toggled trigger to <No Item>.
toggledTrigger.RelativeMessageSource = null;
}
MessageRoutingModeEnum RoutingMode
getset

Gets or sets the message routing mode:

  • TUNNELING to intercept only tunneling messages
  • BUBBLING to intercept only bubbling messages
  • TUNNELING_AND_BUBBLING to intercept tunneling and bubbling messages
  • DIRECT to intercept only messages that are sent directly to this node
bool SetHandled
getset

Gets or sets the message handling mode:

  • TRUE to intercept and handle the message. The message stops here, and does not continue neither bubbling nor tunneling in the project tree.
  • FALSE to intercept the message, but let the message continue bubbling or tunneling in the project tree.