iSeries EGL

All things EGL for the iSeries / i5 / Power System

Making a Dialog Box

leave a comment »

The Dialog Box in EGL

This post illustrates how to code a simple dialog box to show a message that instructs the user to be patient while some background activity is executing. One common activity is the loading of data with which to populate the screen.

Shown below is the EGL code that performs the following steps:

  1. Create a label to contain the message.
  2. Create the GridLayout and assigns the label as a child component.
  3. Create a dialog box and assign GridLayout containing the label as a child component.

    //Create a label to contain the message.  Assigning text is optional at this time as it will probably be replaced at runtime.
    loggingViewerDialog_TextLabel1 TextLabel{ layoutData = new GridLayoutData{ row = 1, column = 1 }, text = "Please wait while data is being loaded." };
    
    //Create the GridLayout and assign loggingViewerDialog_TextLabel1 as a child
    loggingViewerDialog_GridLayout GridLayout{ layoutData = new GridLayoutData{ row = 2, column = 3,
        horizontalSpan = 1, verticalAlignment = GridLayoutLib.VALIGN_TOP }, cellPadding = 4, rows = 3, columns = 3,
        children = [ loggingViewerDialog_TextLabel1 ] };
    
    //Create a dialog box and assign loggingViewerDialog_GridLayout as a child 
    loggingViewerDialog DojoDialog {title = "Wait",  children = [ loggingViewerDialog_GridLayout ]} ;

Fig.1 – EGL code for a simple dialog box.

The code shown below shows how to display the dialog box.

    loggingViewerDialog.showDialog();

Fig.2 – Displaying the dialog box.

To hide the dialog, use the following code.

    loggingViewerDialog.hideDialog();

Fig.3 – Hiding the dialog box.

This is the resulting dialog box.

A simple Dialog Box

Advertisements

Written by iseriesadmin

June 22, 2012 at 8:32 am

Posted in EGL DojoDialog

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: