In an earlier tutorial I talked about setting a timed event to control visibility of a notification to a user. It appears when needed, and using the timer, disappears automatically. While this is a workable option, it might be better used in applications that deal with graphics. If you want to simply notify a user that something went wrong, or just give them some extra information, this can be very easily achieved using the Notifier.


To build this tutorial I simply used the Timer project and made the needed changes. I left the interface the same, adding the notifier component, less the clock and notification label.

Drag out the following components to the viewer

  • Button
  • TextBox
  • HorizontalArrangement
  • Label
  • Notifier

Component Properties

  • In the viewer, drag the submit button and textbox into HorizontalArrangement
  • Set SubmitButton text to Submit
  • Set TextBox1 hint to enter something…
  • Set Debug text to You entered:

Open the Blocks Editor to add behaviors


Drag out the following blocks. Reference the screenshot above to see where they plug in.

Procedure to show the notification

  • to procedure arg – rename it to NotifyEmpty
  • Notifier1.ShowMessageDialog
  • Call make text text
  • text text – set value to, You have not entered anything.
  • text text – set value to, \n
  • text text – set value to, Enter something before pressing Submit.
  • text text – set value to Empty Value Warning
  • text text – set value to OK

What it does. The above sets up a procedure that will provide the necessary information to the notifier. This is what the user will see when the notifier is called. The title socket set the header text and the buttonText, sets the label for the button that closes the notifier window.

Event on Submit

  • ifelse test
  • equals block
  • TextBox1.Text
  • text text – set value to empty. Delete value and leave it blank.
  • call NotifyEmpty
  • set Debug.Text to
  • call make text text
  • text text – set value to, You entered:\n
  • TextBox1.Text
  • set TextBox1.Text to
  • text text – set value to empty. Delete value and leave it blank

Since we are checking for two possible conditions when we click the Submit button, we need to use the ifelse test block so that we can verify the condition we are watching for and if it returns true back to the app, the block will execute the then-do portion of the function. Since we want to make sure an empty string is not passed to our app, we set our test condition to check the TextBox1.Text value currently in that field and ask if it’s equal to nothing, which is represented by the text block with a blank value, on the right side of the equals. When the app is running if the user hits Submit without entering anything, the app will receive a true and call the procedure we declared. The notifier will build out the text we provided and pop the notification window. At this point the user is informed and after clicking OK, will enter something into the field and press Submit again. This time a false will be returned to the app, and it will run the else-do portion of the function. In this example that set of instructions will set the Debut.Text label to display, “You entered:” followed by a new line character “\n” and the value entered in TextBox1.Text. Before it exits, it will blank out the entry in TextBox1.Text, which will reveal the hint text that was entered in it’s properties.

Try it out on your device. The notifier has other options, that can even be used to make decisions based on user response to the buttons. As you can imagine this is a very nice thing to have, because without it, you would have to build this notification with buttons into the interface and build additional instructions for handling them. Using the Notifier, you simply call your procedure and then act on the user response.

You may also like...