Mobile Development 10.11 | webMethods Mobile SuiteWeb Help | webMethods Mobile Designer Native User Interface Reference | Native User Interface (NativeUI) Objects | nUIPopupMenuBuilder
 
nUIPopupMenuBuilder
com.softwareag.mobile.runtime.nui.nUIPopupMenuBuilder
Use to display a lightweight multiple-choice pop-up menu.
Usage Notes
*Unlike other NativeUI widgets, the pop-up menu is created indirectly through a builder. This builder does not need to be placed anywhere in the user interface hierarchy.
*Based on the platform and the available screen size, the pop-up either appears as a menu attached to a nominated on-screen widget, or at the bottom of the screen. Passing the anchor element is mandatory. Calls to show() with null have no effect.
*Each element inside the menu has a text label and an associated action. If the action is null, the menu is closed without taking any actions.
*A Cancel button is available on some platforms. The text of this button can be changed.
Example
This code sample displays a simple pop-up menu with three items. Details on how the example code is rendered on various platforms follow the code sample.
nUIPopupMenuBuilder builder = new nUIPopupMenuBuilder();

//Adding some items to the popup
builder.addItem("Do Something", new DoSomethingRunnable());
builder.addItem("Do Another Thing", new DoAnotherThingRunnable());
builder.addItem("Do Nothing", null);
...

// Later on, we can show the popup.
// We're anchoring to the button that triggered it...
//nUIButtonElement "aNuiButton" is defined elsewhere.
builder.show(aNuiButton);
Platform
Platform-Specific Class and Visual Reference
Android
android.widget.PopupMenu
iOS
UIAlertAction or UIActionSheet, depending on OS version