Skip to content

Set User Interface Element Context

Set User Interface Element Context

Sets or change the data context on a specific user interface element.

Properties

System

Name Explanation Type
Child Context The name of the child property to use as the context. String
Context The context provider to use for supplying data to the element. User Interface Context
Context Filters The filter groups to apply to the context. Filter
Local Whether the variable for the unique ID is local or global. Toggle
Source The data source to look up the context object from using a unique ID. Data Source
Use Child Context Whether to use a child property of the current context as the new context. Toggle
Use Context Whether to use a context provider to supply data to the element. Toggle
Use Current Selection Context Whether to use the context of the current selection on the user interface element. Toggle
Use Filters Only Whether to apply filters to the existing context without changing the context itself. Toggle
Use Unique ID and Source Whether to look up the context from a data source using a unique ID stored in a variable. Toggle
User Interface Element The unique ID of the user interface element to set the context on. Variable or Value
Variable Index The index of the variable that contains the unique ID for the data source lookup. Number

Examples

Set Element Context to the Current Selection

This sets the context of the element whose unique ID is stored in Global Variable 0 to the current selection context.

set_ui_element_context($gv[0], current);
{"Data":{"ChildContext":null,"ContextFilterGroups":[],"ContextProvider":null,"ID":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"Index":0,"IsLocal":false,"Source":null,"UseChildContext":false,"UseContext":false,"UseContextFiltersOnly":false,"UseCurrent":true,"UseDataSource":false,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.UserInterface.SetUserInterfaceElementContextCommand"}

Set Element Context Using a Child Property

This sets the context of the element to a child property named 'Inventory' from the current context.

set_ui_element_context($gv[0], child("Inventory"));
{"Data":{"ChildContext":"Inventory","ContextFilterGroups":[],"ContextProvider":null,"ID":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"Index":0,"IsLocal":false,"Source":null,"UseChildContext":true,"UseContext":false,"UseContextFiltersOnly":false,"UseCurrent":false,"UseDataSource":false,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.UserInterface.SetUserInterfaceElementContextCommand"}

Set Element Context from a Data Source Using a Unique ID

This sets the context of the element by looking up a hero from the data source using the unique ID stored in Global Variable 1.

set_ui_element_context($gv[0], data_source(hero, $gv[1]));
{"Data":{"ChildContext":null,"ContextFilterGroups":[],"ContextProvider":null,"ID":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"Index":1,"IsLocal":false,"Source":null,"UseChildContext":false,"UseContext":false,"UseContextFiltersOnly":false,"UseCurrent":false,"UseDataSource":true,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.UserInterface.SetUserInterfaceElementContextCommand"}