Scripting

Dialogs and Notifications

The application offers the following dialogs and notifications:

  1. Notification
  2. Error
  3. Pop-Up with OK and Cancel
  4. Pop-Up with Custom Answers

Additionally, elements within the application can be shown and hidden.

Notifications

A simple notification can be created with the following code:

Message

runtime.shownotification('This is a notification message with 5 seconds duration.', notifieroptions.formessages(5000))

Error Messages

For an error message, adjust the code as follows:

Error_message

runtime.shownotification('This is an error message with 10 seconds duration.', notifieroptions.forerrormessages(10000))

Standard Pop-Up

A standard pop-up can be created with the following line of code:

Pop_up

runtime.showdialog('Simple Pop-Up Header', 'Simple Pop-Up Body Text.')

Custom Pop-Up

For a custom pop-up, it is necessary to define two functions beforehand, which will be triggered based on the selection within the pop-up.

The code for this pop-up is as follows:

Custom_pop_up

runtime.showdialog('Pop-Up with Custom Answers Header', 'Pop-Up with Custom Answers Body. You can attach your own functions to the buttons below and change their text.', 'I agree', 'I decline', AgreeFunction, DisagreeFunction)

Controlling Element Visibility

To control the visibility of various elements within the application, the following code can be used:

Visible

if screens['Screen1'].groups['Group2'].visible then
   screens['Screen1'].groups['Group2'].hide()
else
   screens['Screen1'].groups['Group2'].show()
end

We are learning from you!

Did you find this article helpful?

Be enlightened!

Do you need more support?

Peakboard Youtube icon Visit our YouTube channel

Our numerous videos for beginners and advanced users explain exactly how to design your dashboard.

Peakboard Templates icon Visit the Peakboard Templates

Download our templates for various use cases for free.

Peakboard icon Visit www.peakboard.com

Find out all about Peakboard and browse our different use cases and success stories.