Okay, an Event has happened! You’ve clicked a button, or click in a text box, or whatever. Great! Now what? Well, as we discussed, what follows are Actions precipitated by that Event.
But when you’re building a screen yourself, you decide what Actions will take place. The possibilities are limitless - you can have an event cause only one action (like closing a window), or multiple interrelated actions, but it’s important to remember they’ll happen in a sequential order. Actions occur one after another.
Let’s illustrate how this might work.
Let’s say you have a blank, brand-new screen. This screen does...well, nothing, at the moment, because it has just one Section and that's it! So let’s give it a button. I will drag one from the Insert Controls panel into the empty section. Perfect.
Now we need to edit the button - there are two ways to do this. You can go through the Edit Control Panel on the right, or you can click the down arrow on the button itself.
We’ve chosen to edit a button because it’s nice and simple: it only has one event associated with it, which you shouldn’t be surprised to learn is the Click Event.
Clicking on the Event makes the Action Editor pop up.
The Action Editor is split into a list on the left, and action preferences on the right. You can add as many actions as you want. We’re not going to list every action in Method right here - that’s what the List of Actions is for.
For our purposes, let’s make this button do something simple, like display a Hello message. See the search bar? I'll search for the action Show Message and then select it!
I'll fill it in with:
The Internal Note is worth including, because it allows you to keep track of what your action is designed to do. This might not sound like a big deal, but believe us - when you get to building controls with maybe tens of actions associated with them, it’s helpful to know what each was meant to do. Also, if anybody else is working on your app, they’ll have a road map to what you were intending to do as well!
Actions are automatically saved, so once complete, I'll close the action editor with the Close button at the top. I will then close the design mode of the screen and give my button a try! It will display our message:
In the Method terms we’ve just discussed, the user initiates a Click Event by clicking the button, which triggers the Show Message Action, bringing up the message box. It’s that simple.
Creating more complicated action series for controls is really just building on these basic principles, which we’ll explore in the Mission section. And, for a full list of actions available in Method, check out the Reference section. In the meantime, that’s your introduction to Events and Actions!