Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column
width350px



Panel
titleTable of Contents

Table of Contents
indent0px

 

Column
width80%

The Goal of This Example

Show how a Universal Display File can work in tandem with a Rich Display File's List Box Widget's choices URL property. You could also utilize the choices URL property within a Combo Box Widget, but this example will be using a List Box Widget.

Info
titleFiles Used by This Example

Below are downloadable versions of the files used in this example:

...

What this program will do is grab a list of colors from a specified database file, COLORSP for this example, on the IBM i and create a JSON object that will contain the option objects that will populate the List Box.  CONAME will display in the List Box and the corresponding COHEX will be passed to the program when a selection is made.

Section
Column
width85%80%
Code Block
languagecpp
titleUniversal Display RPG Source Code File
firstline000100
linenumberstrue
collapsetrue
**FREE          // This program is utilizing FREE-FORMAT RPG
ctl-opt DFTACTGRP(*NO);

dcl-f   COLORSD WorkStn
                // Use the Universal Handler as the handler in this program.
                Handler('UNIVERSAL(HANDLER)');
dcl-f   COLORSP Keyed;
 
Write   Header; // Write the Header from the Universal Display File to the JSON object.
Read    COLORS; // Read a record from the database file COLORSP. 
Dow Not %Eof(); // While not at the end of COLORSP
  Write Body;   // Write the record to the JSON object
  Read  COLORS; // Read the next record of COLORSP
EndDo;
 
Write  Footer;  // Write the Footer from teh Universal Display File to the JSON object.
 
// End program
*InLr = *On;
RETURN;
Column
width15%20%
Note
titleRemember!

Hard coded libraries are a bad practice! We strongly suggest you do not use hard coded libraries!

...

File name is SHOWCOLORR. Notice that the ProfoundUI Handler is being used in the handler for this program. The EXFMT operation will display the SHOWCOLORD display file. 

Section
Column
width85%80%
Code Block
languagecpp
titleRich Display RPG Source Code
firstline000100
linenumberstrue
collapsetrue
**FREE  // This program is utilizing FREE-FORMAT RPG
ctl-opt DFTACTGRP(*NO);
dcl-f   SHOWCOLORD WorkStn 
        // Use the ProfoundUI Handler as the handler in this program
        Handler('PROFOUNDUI(HANDLER)');
 
// Run program until the exit button is pressed
Dou BTNEXIT = *On;
 ExFmt SHOWCOLORS;
EndDo;

// End program
*InLr = *On;
RETURN;
Column
width15%20%
Note
titleRemember!

Hard coded libraries are a bad practice! We strongly suggest you do not use hard coded libraries!

...

Section
Column
width30%
 
Column
width300px

Column
width300px
Info
iconfalse

Actions in Order:

  1. Select Silver -> Click Ok
  2. Select Red

  3. Scroll down using ▼ of the scrollbar
  4. Double-click Olive to select and pass to program
  5. Select Maroon -> Press "Enter" on keyboard
  6. Click Exit to exit the program

 

Column
width30%

 

...