Events - AppDaddy-Software-Solutions-Inc/framework-markup-language GitHub Wiki

Events are a list of one or more comma ";" separated system or widget method's calls to be executed. Events can contain constants, bindings and evaluations as parameters.

All events have a return value of *boolean. When an event fails, subsequent events in the list are ignored and execution terminates immediately.

Below is a list of non-widget specific methods. Refer to widget documentation for supported method's.

Methods

Name Description
alert ( [ $${\color{blue}string}$$ type = "none", $${\color{blue}string}$$ title, $${\color{blue}string}$$ message ] ) Pops an alert dialog with the specified title and message displayed and the icon defined by type as
  • error
  • success
  • info
  • modal
  • warning
  • none

  •   See it in Action
    back ( $${\color{blue}dynamic}$$ until = 1 ) This is a convenience method for close() an is intended for the sole purpose of readability. Refer to the close() method below.
      See it in Action
    build ( $${\color{blue}string}$$ xml, [ $${\color{blue}bool}$$ modal = false, $${\color{blue}string}$$ transition ] ) Builds and parses a new template from the supplied xml string.

    If modal is true, the template is opened in a modal window on the same page.

    If modal is false, the template is opened in a new page pushed onto the naviagtion stack.

    The transition between pages can be

    clearbranding ( ) Application branding is a build in feature in FML mobile for setting a custom icon and title for an application whene the application is launched for the first time.

    Once the application has been branded, the only way to clear the brading is via this method.

    This method is rarely used an is more for development purposes.
    close ( $${\color{blue}dynamic}$$ until = 1 ) Close pops pages off the navigation stack.

    If until is an integer, back will pop the specified number of pages or until the root page is encountered.

    If until is non-numeric string, until is assumed to be the name of the page. If a page by that name is on the navigation stack, pages ahead of the page are removed from the navigation stack.

    For example:

  • close() - Pops the current page
  • close(5) - Pops 5 pages off the navigation stack
  • close('main.xml') - Pops pages until page main.xml
  • continue ( [ $${\color{blue}string}$$ type = "none", $${\color{blue}string}$$ title, $${\color{blue}string}$$ message, $${\color{blue}string}$$ phrase1 = 'Yes', $${\color{blue}string}$$ phrase2 = 'No', ] ) Pops a dialog box with the specified title and message displayed and the icon defined by type as
  • error
  • success
  • info
  • modal
  • warning
  • none
  • In addition, the dialog includes 2 buttons, left and right. The left button when clicked returns true, the right button returns false. If false, the method returns false and execution of subsequent methods terminates immediately. This is used quite often when confirming before submission of forms or when exiting a page.
      See it in Action

    copy ( $${\color{blue}string}$$ text, [ $${\color{blue}string}$$ toast = true, ] ) Copies the specified text to the clipboard. If toast is true, a system toast message "Copied to Clipboard ..." is displayed.
      See it in Action
    logon ( $${\color{blue}string}$$ provider, [ $${\color{blue}bool}$$ refreshPage = true ] ) Negotiates a third party signin using Firebase authentication where provider is microsoft, facebook, google, etc.

    Before use, Firebase must be configured as per these setup instructions.

    Additionally, the provided FIREBASE_API_KEY and FIREBASE_AUTH_DOMAIN entries must be added to the config.xml file.

    Default oauth provider scopes are ['email', 'profile'].

    On valid login, subsequent HTTP requests will include the providers json web token in the request authorization header.

    Sets {USER.connected} to true and sets a {USER.<claim>} bindable for each public claim in the jwt.

    It is a good practice for the remote server to validate this jwt with the provider and return a local jwt in the response authorization header as described here.

    If refreshPage is set, the current page is refreshed after successful logon.

    This is somewhat tricky to setup for mobile on Android as it requires a custom compile. We can help. Book a meeting with us and lets discuss it.

      See it in Action
    logoff ( [ $${\color{blue}bool}$$ refreshPage = true ] ) Logs the current user out and signs out of third party signin. Sets {USER.connected} to false and clears all {USER.<claim>} bindables.

    If refreshPage is set, the current page is refreshed after successful logon.

      See it in Action
    open ( $${\color{blue}string}$$ url, [ $${\color{blue}bool}$$ modal = false, $${\color{blue}string}$$ transition = "platform", $${\color{blue}bool}$$ replace = false, $${\color{blue}bool}$$ replaceAll = false ] ) Opens the a window and loads the specified url where url is a valid web address (ie. http://google.com), a full or partial path to an fml template (ie. /templates/main.xml)

    If modal is set, the page is displayed in a popup window.

    The transition defines how the page animates into view.
  • none
  • platform
  • fade
  • slideleft
  • slideright
  • zoom
  • rotate

  • If replace is set, the current page is replaced by the new page.

    If replaceAll is set, all pages are removed and the new page is displayed.
    refresh ( ) Reloads the current page's template from the server and reloads the current page.
    saveas ( $${\color{blue} dynamic}$$ content, [ $${\color{blue} string}$$ fileName = "file.txt" ] ) Encodes content as UTF8 and launches the platform's file save dialog.
    set ( $${\color{blue} string}$$ key, $${\color{blue} int}$$ value ) Alternate method for setting a bindable

    Sets the widget property identified by id to the specified value.

    Example: set('myicon.color','red')
    sound ( [ $${\color{blue} string}$$ url = "beep", $${\color{blue} int}$$ duration = 0 ] ) Plays the specified .wav or .mps sound file located at url for duration seconds or until finished, whichever is less.

    If url is not specified, a default beep sound is played.

    If duration <=0, the sounds plays once to completion.

      See it in Action
    stash ( $${\color{blue} string}$$ key, $${\color{blue} int}$$ value ) Alternate method for setting a STASH value.

    Sets the stash key to the specified value.

    Example: stash('first_name','joe')
    theme ( $${\color{blue}string}$$ brightness, [ $${\color{blue}string}$$ colorScheme, $${\color{blue}string}$$ font = "Roboto" ] ) Set the current theme to the specified brightness (light, dark) and color scheme using the specified google font.

      See it in Action
    toast ( $${\color{blue} string}$$ message, [ $${\color{blue} int}$$ duration = 2 ] Displays the specified message as a system toast for duration seconds.
    wait ( $${\color{blue}int}$$ seconds ) Sleeps for the specified number of seconds before executing the next event in the chain.

    Other Widgets You May Find Useful:

    ⚠️ **GitHub.com Fallback** ⚠️