WaveLinkMessageBox Samples

The following sample code demonstrates the implementation and capabilities of the Class WaveLinkMessageBox and its associated methods.

Java Sample

package samplecode;

 

import com.wavelink.clientui.*;

import java.io.*;

public class MessageBoxDemo extends WaveLinkApplication {

public void WaveLinkMain(String[] args) {

// This application demonstrates the use of the various WaveLinkMessageBox methods.

// It assumes a display area of 20x8. In practice, you use a WaveLinkTerminal object to format output to fit

// the current device. The following lines clear the display and output the app title in reverse video.

try {

WaveLinkIO ioIface = new WaveLinkIO();

WaveLinkMessageBox msgIface = new WaveLinkMessageBox();

String strBuffer;

ioIface.RFPrint(0, 0, " Welcome To The ", WaveLinkIO.WLCLEAR | WaveLinkIO.WLREVERSE);

ioIface.RFPrint(0, 1, " MessageBox Demo ", WaveLinkIO.WLREVERSE);

ioIface.RFPrint(0, 3, "Hit a key to proceed", WaveLinkIO.WLNORMAL);

// Hide the cursor for a cleaner display

ioIface.RFPrint(0, 20, "", WaveLinkIO.WLNORMAL);

ioIface.GetEvent();

// During the course of any application, there are times when you wish to notify a user of an error

// condition which has arisen. The WaveLinkMessageBox object is the preferred method

// for doing this over anRF network. The first sample defines and displays an error message for 2 seconds

msgIface.SetMessageLine(" This error will ", 0);

msgIface.SetMessageLine(" display for 2 ", 1);

msgIface.SetMessageLine(" seconds ", 2);

msgIface.Display(2);

// Now we define and display an error message, but require the user to acknowledge the error

// by pressing the CLR (Escape) key by setting a zero (0) timeout.

msgIface.ClearMessage();

msgIface.SetMessageLine("Acknowledge this", 1);

msgIface.SetMessageLine("error, please. ", 2);

msgIface.SetMessageLine(" ", 3);

msgIface.Display(0);

// When an application must perform an extended operation, it is usually a good idea to provide

// the user with a visual indicator of progress.

ioIface.RFPrint(0, 0, " Performing a time- ", WaveLinkIO.WLCLEAR);

ioIface.RFPrint(0, 1, " consuming job! ", WaveLinkIO.WLFLUSHOUTPUT);

msgIface.ClearMessage();

for ( int lcv = 25; lcv < 100; lcv += 25 ) {

strBuffer = "" + Integer.toString(lcv) + "% Complete ";

msgIface.SetMessageLine(strBuffer, 0);

msgIface.Display(1);

}

}

catch ( WaveLinkError wlErr ) {

//Do error handling

}

}

}

 


Was this article useful?    

The topic was:

Inaccurate

Incomplete

Not what I expected

Other

Privacy and Legal