Kanzi 3.9.16
TriggerConditionItem Interface Reference

Configure trigger conditions. More...

Inheritance diagram for TriggerConditionItem:
[legend]
Collaboration diagram for TriggerConditionItem:
[legend]

Properties

TriggerConditionOperation ConditionOperation [get, set]
 Gets or sets the comparison operator that you use to compare Value A to Value B:
 
object FixedPropertyValue [get, set]
 
bool IsValid [get]
 Gets the validity of the trigger condition.
 
Property MessageA [get, set]
 
Property MessageB [get, set]
 
ProjectItem ProjectItemA [get, set]
 
ProjectItem ProjectItemB [get, set]
 
Property PropertyA [get, set]
 
AnimationTargetPropertyAttributeEnum PropertyAttributeA [get, set]
 
AnimationTargetPropertyAttributeEnum PropertyAttributeB [get, set]
 
Property PropertyB [get, set]
 
new TriggerConditionItemProperties PropertyTypes [get]
 
TriggerConditionTermSourceType TermASource [get, set]
 
TriggerConditionTermSourceType TermBSource [get, set]
 Gets or sets whether the trigger condition compares to a value (Value B) that comes from a property, a message, or a fixed value:
 
- Properties inherited from ProjectItem
IEnumerable< ProjectItem > Children [get]
 Gets all child items of a project item.
 
string IconLocation [get]
 
object IconModifier [get, set]
 
string InvalidityReason [get]
 
bool IsDeleted [get]
 
bool IsDisposed [get]
 
bool IsHidden [get, set]
 
bool IsReadOnly [get, set]
 
bool IsValidState [get]
 
string KzbUrl [get]
 Gets the kzb URL of a project item.
 
string Name [get, set]
 Gets or sets the name of a project item.
 
ProjectItem Parent [get, set]
 
string Path [get]
 
Project Project [get]
 Gets the project in which this item is located.
 
Type ProjectItemType [get]
 
PropertyTypeLibrary PropertyTypeLibrary [get]
 Gets the Property Types library of the project of this item which stores all property types you create in a Kanzi Studio project.
 
object this[Property property] [get, set]
 
object this[string propertyName] [get, set]
 
string ToolTip [get]
 
string TypeDisplayName [get]
 Gets the type of a project item.
 
- Properties inherited from PropertyContainer
IEnumerable< Property > Properties [get]
 Gets the properties in a project item or node component.
 

Additional Inherited Members

- Public Member Functions inherited from ProjectItem
void AddProperty (Property property)
 Adds a property to an item.
 
void AddProperty (string propertyName)
 Adds a property to an item.
 
void BeginBatchModification (string batchName)
 
bool CanAddProperty (Property property)
 Checks whether Kanzi Studio allows you to add a specific property to an item.
 
bool CanAddProperty (string propertyName)
 Checks whether Kanzi Studio allows you to add a specific property to an item.
 
void CommitBatchModification ()
 
bool Delete ()
 Deletes a project item.
 
void DeregisterThumbnailUser (object user)
 Deregisters a registerd thumbnail user.
 
IEnumerable< Property > GetAddableProperties ()
 Gets a list of properties which you can add to an item.
 
T GetAncestor< T > ()
 Gets the nearest item of given type in the parent tree.
 
ProjectItem GetChild (string childName)
 Gets the child item of the current item with the given name.
 
T GetChild< T > (string childName)
 Gets the child item of the current item with the given name and type.
 
int GetChildIndex (ProjectItem child)
 
IEnumerable< Property > GetContextProperties ()
 
IEnumerable< Property > GetFixedProperties ()
 
IEnumerable< Property > GetFrequentlyAddedProperties ()
 
ProjectItem GetProjectItemByPath (string path)
 
string GetRelativeProjectPathTo (ProjectItem anotherItem)
 
IEnumerable< Property > GetRemovableProperties ()
 Gets a list of properties which you can remove from an item.
 
BitmapSource GetThumbnail (int width, int height, bool showChildren, bool showFullScreen, Node contextNode)
 Gets the thumbnail image for a project item.
 
BitmapSource GetThumbnail (int width, int height, bool showChildren, bool showFullScreen, Node contextNode, float[] letterboxColorRGBA)
 Gets the thumbnail image for a project item.
 
IEnumerable< ProjectItem > GetTreeItemsAsList ()
 Enumerates the items under this ProjectItem including this item itself, children, and grand children.
 
bool HasProperty (Property property)
 Checks whether an item has a specific property.
 
bool HasProperty (string propertyName)
 Checks whether an item has a specific property.
 
bool IsPropertyReadOnly (Property property)
 
void RegisterThumbnailUser (object user, uint width, uint height, bool showChildren, bool showFullScreen, Node contextNode)
 Registers a user for the thumbnail images for a project item.
 
void RemoveProperty (Property property)
 Removes a property from an item.
 
void RemoveProperty (string propertyName)
 Removes a property from an item.
 
void SetChildIndex (ProjectItem child, int index)
 
void SetPropertyReadOnlyStatus (Property property, bool? value)
 
void UpdateValidity ()
 Recalculates the validity the item.
 
- Public Member Functions inherited from PropertyContainer
object Get (Property property)
 Gets the value of a property.
 
object Get (string propertyName)
 Gets the value of a property.
 
T Get< T > (TypedProperty< T > property)
 Gets the value of a property.
 
void Set (string propertyName, object value)
 Sets the value of a property.
 
void Set< T > (TypedProperty< T > property, T value)
 Sets the value of a property.
 
- Public Member Functions inherited from ChildContainer
string GenerateUniqueChildName (string defaultName)
 Generates a unique name.
 
string GetInvalidityReasonOfNewName (string newName)
 Returns the reason why the passed name is not valid.
 
- Events inherited from ProjectItem
EventHandler< CollectionChangedEventArgs< ProjectItem > > ChildCollectionChanged
 
EventHandler< DeletedEventArgs > Deleted
 
EventHandler< DeletedEventArgs > Deleting
 
EventHandler< CollectionChangedEventArgs< ProjectItem > > DescendantChildCollectionChanged
 
EventHandler< DeletedEventArgs > DescendantDeleted
 
EventHandler< DynamicPropertyChangedEventArgs > DescendantDynamicPropertyChanged
 
EventHandler< ParentChangedEventArgs > DescendantParentChanged
 
EventHandler< CollectionChangedEventArgs< string > > DescendantPropertyCollectionChanged
 
EventHandler< ProjectItemEventArgs > Disposing
 
EventHandler< DynamicPropertyChangedEventArgs > DynamicPropertyChanged
 
EventHandler< ParentChangedEventArgs > ParentChanged
 
EventHandler< PathChangedEventArgs > PathChanged
 
EventHandler< DynamicPropertyChangedEventArgs > PreviewDescendantDynamicPropertyChanged
 
EventHandler< DynamicPropertyChangedEventArgs > PreviewDynamicPropertyChanged
 
EventHandler< CollectionChangedEventArgs< string > > PropertyCollectionChanged
 
EventHandler< ReplaceEventArgs > Replacing
 
EventHandler ThumbnailChanged
 
EventHandler ValidityChanged
 

Detailed Description

Configure trigger conditions.

Trigger conditions enable you to set which conditions must be met for the trigger to set off. For example, you can define conditions to set off a trigger when the user selects a specific item in a list box or presses a specific key on their keyboard, or to enable the user to click a button only when that button is visible, or to allow the user to scroll a Scroll View node only when a specific Page node is active.

To configure a trigger condition, define Type of A and Type of B, and a comparison operation that you use to compare Type of A to Type of B:

  • To define Type of A to come from a property, set the #TermASource, #ProjectItemA, #PropertyA, and #PropertyAttributeA properties.
  • To define Type of A to come from a message, set the #TermASource and #MessageA properties.
  • To define the Operation, set the #ConditionOperation property.
  • To define Type of B to come from a property, set the #TermBSource, #ProjectItemB, #PropertyB, and #PropertyAttributeB properties.
  • To define Type of B to come from a message, set the #TermBSource and #MessageB properties.
  • To define Type of B to be a fixed value, set the #TermBSource and #FixedPropertyValue properties.
See also
TriggerNodeComponent, TriggerActionItem, NodeComponentHost

Examples

To create and configure a trigger condition using a value from a property:

// Create and configure a trigger condition which makes a trigger set off only
// when the Visible property of the Button 2D node is enabled:
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Button 2D node in the RootPage node.
var button =
studio.ActiveProject.CreateProjectItem<Button2D>(rootPage.GenerateUniqueChildName("Button 2D"), rootPage);
// Add the Visible property for the Button 2D node and set it to true.
button.Set(Properties.NodeVisible, true);
// Get the first Button: Click trigger in the Button 2D node.
var clickTrigger =
button.Triggers.First(
trigger => trigger.Get(
Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// Create a trigger condition for the first Button: Click trigger in the Button 2D node.
var triggerCondition = clickTrigger.CreateCondition();
// Set the trigger condition to compare a value that comes from a property.
triggerCondition.TermASource = TriggerConditionTermSourceType.FROM_PROPERTY;
// Set the node the property of which you want to compare to Button 2D.
triggerCondition.ProjectItemA = button;
// Set the property which you want to compare to Visible.
triggerCondition.PropertyA = Properties.NodeVisible;
// Set the property attribute which you want to compare.
// Because you want to compare the NodeVisible property and not its attribute, use WHOLE_PROPERTY.
triggerCondition.PropertyAttributeA = AnimationTargetPropertyAttributeEnum.WHOLE_PROPERTY;
// Set the comparison operation to =.
triggerCondition.ConditionOperation = TriggerConditionOperation.EQUALS;
// Set the trigger condition to compare to a fixed value.
triggerCondition.TermBSource = TriggerConditionTermSourceType.FIXED;
// Set the fixed value to true.
triggerCondition.FixedPropertyValue = true;
}

To create and configure a trigger condition using a value from a list box message:

// Create and configure a trigger condition which makes a trigger set off only
// when the user selects any item but the first one in a Grid List Box 2D node:
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Grid List Box 2D node in the RootPage node.
var listBox =
studio.ActiveProject.CreateProjectItem<GridListBox2D>(rootPage.GenerateUniqueChildName("Grid List Box 2D"), rootPage);
// Create a List Box: Item Selected trigger in the Grid List Box 2D node.
var itemSelectedTrigger = listBox.CreateTrigger(studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName("Kanzi.MessageTrigger"));
itemSelectedTrigger.Set(Properties.TriggerMessageType, studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.ListBox.ItemSelected"));
// Create a trigger condition for the List Box: Item Selected trigger in the Grid List Box 2D node.
var triggerCondition = itemSelectedTrigger.CreateCondition();
// Set the trigger condition to compare a value that comes from a message.
triggerCondition.TermASource = TriggerConditionTermSourceType.FROM_MESSAGE;
// Set the message argument which you want to compare to the index of the selected item of the Grid List Box 2D node.
triggerCondition.MessageA = Properties.ListBoxConceptItemSelectedMessageArgumentsSelectedItemIndex;
// Set the comparison operation to !=.
triggerCondition.ConditionOperation = TriggerConditionOperation.DIFFERENT;
// Set the trigger condition to compare to a fixed value.
triggerCondition.TermBSource = TriggerConditionTermSourceType.FIXED;
// Set the fixed value to 0 to make the trigger set off when the user selects any item but the first one in the Grid List Box 2D node.
triggerCondition.FixedPropertyValue = 0;
}

To create and configure a trigger condition using a value from a keyboard message:

// Create and configure a trigger condition that makes a trigger set off when the user presses the Enter key:
public void Execute(PluginCommandParameter parameter)
{
// The keyboard input code for the Enter key is 46.
// In the Kanzi UI documentation see Reference > Keyboard input codes reference.
const int EnterKeyCode = 46;
// Create a Key Pressed trigger in the Screen node.
var keyPressedTrigger = studio.ActiveProject.Screen.CreateTrigger(studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName("Kanzi.MessageTrigger"));
keyPressedTrigger.Set(Properties.TriggerMessageType, studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.KeyPressed"));
// Create a trigger condition for the Key Pressed trigger in the Screen node.
var triggerCondition = keyPressedTrigger.CreateCondition();
// Set the trigger condition to compare a value that comes from a message.
triggerCondition.TermASource = TriggerConditionTermSourceType.FROM_MESSAGE;
// Set the message argument which you want to compare to the target key.
triggerCondition.MessageA = Properties.InputMessageArgumentKey;
// Set the comparison operation to =.
triggerCondition.ConditionOperation = TriggerConditionOperation.EQUALS;
// Set the trigger condition to compare to a fixed value.
triggerCondition.TermBSource = TriggerConditionTermSourceType.FIXED;
// To make the trigger set off when the user presses the Enter key, set the fixed value to the Enter key.
triggerCondition.FixedPropertyValue = EnterKeyCode;
// Create a Write Log action in the Key Pressed trigger.
var writeLogAction = keyPressedTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.WriteLogAction"));
// In the Write Log action set Log Text to "Enter pressed".
writeLogAction.Set(Properties.WriteLogActionLogText, "Enter pressed");
// Get the Key Manipulator node component type.
var keyManipulatorType = studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName(NodeComponentTypeNames.KeyManipulatorComponent);
// Create a Key Manipulator component named Key Manipulator in the Screen node.
var keyManipulator = studio.ActiveProject.Screen.CreateNodeComponent("Key Manipulator", keyManipulatorType);
// Set the Logical Key property to the Enter key.
keyManipulator.Set(Properties.KeyManipulatorComponentLogicalKey, EnterKeyCode);
}

Property Documentation

◆ ConditionOperation

TriggerConditionOperation ConditionOperation
getset

Gets or sets the comparison operator that you use to compare Value A to Value B:

  • NONE for none
  • EQUALS for =
  • DIFFERENT for !=
  • SMALLER for <
  • BIGGER for >
  • SMALLER_OR_EQUALS for <=
  • BIGGER_OR_EQUALS for >=

◆ FixedPropertyValue

object FixedPropertyValue
getset

Gets or sets the fixed value to which you want to compare.

To use this property, set TermBSource to FIXED.

See also
TermBSource

◆ IsValid

bool IsValid
get

Gets the validity of the trigger condition.

Returns
True if the trigger condition is valid, otherwise false.

◆ MessageA

Property MessageA
getset

Gets or sets the message argument which you want to compare.

To use this property, set TermASource to FROM_MESSAGE.

See also
TermASource

◆ MessageB

Property MessageB
getset

Gets or sets the message argument to which you want to compare.

To use this property, set TermBSource to FROM_MESSAGE.

See also
TermBSource

◆ ProjectItemA

ProjectItem ProjectItemA
getset

Gets or sets the project item a property of which you want to compare.

To use this property, set:

  • TermASource to FROM_PROPERTY.
  • PropertyA to the property which you want to compare
  • PropertyAttributeA to the property attribute which you want to compare
See also
TermASource, PropertyA, PropertyAttributeA

◆ ProjectItemB

ProjectItem ProjectItemB
getset

Gets or sets the node to a property of which you want to compare.

To use this property, set:

  • TermBSource to FROM_PROPERTY.
  • PropertyB to the property which you want to compare
  • PropertyAttributeB to the property attribute which you want to compare
See also
TermBSource, PropertyB, PropertyAttributeB

◆ PropertyA

Property PropertyA
getset

Gets or sets the property which you want to compare.

To use this property, set:

  • TermASource to FROM_PROPERTY
  • ProjectItemA to the project item the property of which you want to compare
  • PropertyAttributeA to the property attribute which you want to compare
See also
TermASource, ProjectItemA, PropertyAttributeA

◆ PropertyAttributeA

AnimationTargetPropertyAttributeEnum PropertyAttributeA
getset

Gets or sets the property attribute which you want to compare.

To compare the whole property instead of an attribute, use WHOLE_PROPERTY.

To use this property, set:

  • TermASource to FROM_PROPERTY
  • ProjectItemA to the project item the property of which you want to compare
  • PropertyA to the property which you want to compare
See also
TermASource, ProjectItemA, PropertyA

◆ PropertyAttributeB

AnimationTargetPropertyAttributeEnum PropertyAttributeB
getset

Gets or sets the property attribute to which you want to compare.

To compare to the whole property instead of an attribute, use WHOLE_PROPERTY.

To use this property, set:

  • TermBSource to FROM_PROPERTY
  • ProjectItemB to the project item to the property of which you want to compare
  • PropertyB to the property to which you want to compare
See also
TermBSource, ProjectItemB, PropertyB

◆ PropertyB

Property PropertyB
getset

Gets or sets the property to which you want to compare.

To use this property, set:

  • TermBSource to FROM_PROPERTY
  • ProjectItemB to the project item to the property of which you want to compare
  • PropertyAttributeB to the property attribute to which you want to compare
See also
TermBSource, ProjectItemB, PropertyAttributeB

◆ PropertyTypes

Implements ProjectItem.

◆ TermASource

TriggerConditionTermSourceType TermASource
getset

Gets or sets whether the trigger condition compares a value (Value A) that comes from a property or a message:

  • FROM_PROPERTY for property
  • FROM_MESSAGE for message

◆ TermBSource

TriggerConditionTermSourceType TermBSource
getset

Gets or sets whether the trigger condition compares to a value (Value B) that comes from a property, a message, or a fixed value:

  • FIXED for fixed value
  • FROM_PROPERTY for property
  • FROM_MESSAGE for message