Setting Up the Application Code to Use the NativeUI Library
When coding the application, be sure to import com.softwareag.mobile.runtime.nui.* and extend the CanvasNativeUI class.
To set up the application code to use the NativeUI library
1. Add the following line to the application to import com.softwareag.mobile.runtime.nui.*.
import com.softwareag.mobile.runtime.nui.*
2. Add a line to the application similar to the following to extend the CanvasNativeUI class.
public class MyCanvas extends CanvasNativeUI
In this example, the primary canvas class is MyCanvas.java. In the sample code line, replace MyCanvas with the name of the primary canvas class you are using.
3. Add lines to the application that are similar to the following so that the primary canvas class implements the onCreateMainWindow and nUIEventCallback methods.
protected nUIWindowDisplay onCreateMainWindow()
public boolean nUIEventCallback(nUIObject object, int evt_type)
When the application starts, the NativeUI system is initialized. After the NativeUI system is initialized, the application invokes the onCreateMainWindow method to create your primary nUIWindowDisplay.
Caution: | The application should not try to create any NativeUI components until after invoking onCreateMainWindow. Platform-specific setup occurs along with the creation of the main window. |