This document will guide you through an easy example of the objects that may be called, and how to call them from a Menu for Smart Devices object.
We can call different objects and perform numerous different actions from a Menu for Smart Devices. Each option in a Menu can be created by right-clicking on the root_element/Add/Item.
An event will be triggered when a user taps on one of the items in the Menu. So, we want to have an Event for each Item.
To add an Event (temporary restriction) go to the Events tab and add a new event with a unique name.
To link an Event to the Item of the Menu we have the Name property. The value of this property will be the name of the event that will be executed when the user taps on that option.
The first distinction we can make is that an event in a Menu can call one object or make a composite call. It's easy to call an object, with the user tapping on the icon/tab/line (to see different ways to show a Menu read Several ways to show a Menu for Smart Devices) of the item, to invoke the event and call only one object. The Composite call can help us add a more sophisticated behavior to our Menu (Soon).
For this tutorial, the following Transaction object will be used.
Apply the Work With for Smart Devices object (WWSD) to the Transaction (for further information see Applying Work With for Smart Devices Pattern).
Let's start with a basic example. We want an item in our Menu to call a List node of a Work With for Smart Devices.
a. Now create a new Event on the Events tab with the following code:
Add a new item to our Menu as shown in the image above.
For the Name property use the event name, in this case: WWSDList.
By tapping on this element at run-time, you'll be able to go to the list of Persons.
b. Now let's call the detail view of a WorkWithDevices Pattern. We want to call the View Mode of the Section (General) in the Detail node, so we can view the details on a Person.
We have to take into consideration that the Detail node of an instance of a WWSD with associated BC receives a parameter; the parameter is the PK of the Transaction object. So, in our call, we have to pass the value of the PK of the Person we want to update. In this case, we will make the Event as follows:
Add a new item to the Menu and set the Name property with WWSDDetail.
Sometimes we need or want to call a Transaction directly in one of the modes that the Transaction can be called (Insert, Update, Delete). To do so, the event should be as follows:
If we change the last part we can invoke the Transaction in Insert mode or Delete mode.
Calling objects from the Smart Device API is another way to use our Menu Items.
For this example, we will call the SendMessage method from the Interop External Object. (For more information on the Smart Device API object, read the document HowTo: Using SendMessage from Interop in Smart Devices).
The event programming should be:
Interop.SendMessage("A message", 1234342)
Set the Name property with SDApiCall. This will invoke the SendMessage method with the parameters specified.
Sometimes you can have many Menus, where one of them can call another.
Create a new Menu; set the Name property with SubMenu and save it.
Note: it makes no difference if there are no items on that Menu.
The event will be as follows:
Add a new Item to the Menu and set the Name property with SubMenu.
Let's create a new WorkWithDevices object as shown in the following image:
Create a new Event with the following code:
Lastly, add a new item to the Menu and set the Name property with EntryPanel.
Grammar of Events on the Client Side and Composite Command
Events in Mobile Applications