Page Action

From MSX - Wiki
Revision as of 12:48, 3 March 2021 by Benzac (talk | contribs)
Jump to navigation Jump to search

It is possible to execute an action if a content page becomes active by setting an action property (of type string) to a content page object. An action-related data property (of type object) can also be set. Please see Internal Actions for possible values. This feature is available since version 0.1.112.

Note: A page action is executed before a selection action (which is executed if a content item becomes the focus). If the content page is displayed as overlay page, the action is executed when the entire content becomes active and it is executed before a common page action. If the content page is displayed as underlay page, the action is executed when the entire content becomes visible and it is executed before an overlay page action. Since version 0.1.30 the underlay page action is also executed if the content becomes inactive again (i.e. if a corresponding menu becomes active and the content is visible).

Please see following example.

Example[edit]

Screenshot[edit]

Example Screenshot (Page Action)

Code[edit]

{
    "type": "pages",
    "headline": "Page Action",    
    "underlay": {
        "action": "logger:debug:Content is visible."
    },
    "overlay": {
        "action": "logger:debug:Content is active."
    },
    "pages": [{
            "action": "info:Page 1 is active.",
            "items": [{
                    "layout": "0,0,12,6",
                    "color": "msx-glass",
                    "headline": "Page 1"
                }]
        }, {
            "action": "info:Page 2 is active.",
            "items": [{
                    "layout": "0,0,12,6",
                    "color": "msx-glass",
                    "headline": "Page 2"
                }]
        }, {
            "action": "info:Page 3 is active.",
            "items": [{
                    "layout": "0,0,12,6",
                    "color": "msx-glass",
                    "headline": "Page 3"
                }]
        }]
}

Demo[edit]