...
...
Warning |
---|
|
This example assumes you have familiarized yourself with the Universal Display Files, Using the Universal Display File Editor, and Using the Web Connector! Notes and links may be provided, but complete explanations may not! |
Section |
---|
Column |
---|
| The Goal of This ExampleShow 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 |
---|
title | Files Used by This Example |
---|
| Below are downloadable versions of the files used in this example: - Choices URL in Universal Display File: COLORSD.json
- Universal Display File RPG Code: COLORSR.txt
- Rich Display File: SHOWCOLORD.json
- Rich Dipslay File RPG Code: SHOWCOLORR.txt
- Sample Color Table SQL File: COLORSP.sql (contains the
CREATE TABLE ) Note: This data set was randomly generated meaning that the color name and the hex color associated with it might not match up. The functionality is the same and it is being provided to help users practice.
|
|
|
The Universal Display File
...
Info |
---|
The Insert Field button is used to add bound fields like CONAME and COHEX .
CONAME and COHEX are defined as References to their corresponding field in the table.
The REF keyword containing the NAME of the table is added to File Keywords .
The library containing the table should be added to the Library List.
|
...
The Universal Display RPG Source Code
...
Section |
---|
Column |
---|
|
Code Block |
---|
language | cpp |
---|
firstline | 000100 |
---|
title | Universal Display RPG Source Code File |
---|
firstline | 000100 |
---|
linenumbers | true |
---|
collapse | true |
---|
| **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 the Universal Display File to the JSON object.
// End program
*InLr = *On;
RETURN; |
|
Column |
---|
|
Note |
---|
| Hard coded libraries are a bad practice! We strongly suggest you do not use hard coded libraries! |
|
|
...
Code Block |
---|
language | javascript |
---|
title | Universal Display Result |
---|
collapse | true |
---|
|
{
"success":true,
"response":[
new Option("WHITE","#FFFFFF")
,
new Option("SILVER","#C0C0C0")
,
new Option("GRAY","#808080")
,
new Option("BLACK","#000000")
,
new Option("RED","#FF0000")
,
new Option("MAROON","#800000")
,
new Option("YELLOW","#FFFF00")
,
new Option("OLIVE","#808000")
,
new Option("LIME","#00FF00")
,
new Option("GREEN","#008000")
,
new Option("AQUA","#00FFFF")
,
new Option("TEAL","#008080")
,
new Option("BLUE","#0000FF")
,
new Option("NAVY","#000080")
,
new Option("FUCHSIA","#FF00FF")
,
new Option("PURPLE","#800080")
]
} |
The Rich Display File
Read more about it: Visual Designer Basics, Using the Web Connector, Work with URL Mappings Tool
...
The Choices URL property of the List Box is what populates the choices of colors that can be picked. We set this property to the URL of our Universal Display File application.
Section |
---|
Column |
---|
|
Example Display Arrangement This is an image of the Visual Designer with the arrangement of elements of this example. |
Column |
---|
|
Note |
---|
| Don't forget that the choices url value needs to be mapped! The Web Connector, as of Profound UI Version 5, Fix Pack 10.0, has a URL Mappings Tool that can be used to maintain the URL Mappings, previous versions require a PUIMAPP record to be created. Please notice that the URL shown in the screenshot is /profoundui/universal/colors , this is the URI Mapping I set up using the PUIWRKMAP tool, as shown in the screenshot below (click the thumbnail to view the full size image).
|
|
|
The Rich Display RPG Source Code
...
Section |
---|
Column |
---|
|
Code Block |
---|
language | cpp |
---|
firstline | 000100 |
---|
title | Rich Display RPG Source Code |
---|
firstline | 000100 |
---|
linenumbers | true |
---|
collapse | true |
---|
| **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 |
---|
|
Note |
---|
| Hard coded libraries are a bad practice! We strongly suggest you do not use hard coded libraries! |
|
|
...
To run the program, login to a Genie session and use EDTLIBL
or ADDLIBLE
to make sure the libraries where the program files are stored are in the library list. Then you may run the command CALL YOURLIBRARY/SHOWCOLORR
to run your program and you can display the colors after highlighting a color name and pressing the OK button, double-clicking the color, or selecting a color and pressing the 'Enter' key on your keyboard.
Section |
---|
Column |
---|
|
|
Column |
---|
|
Info |
---|
| Actions in Order: - Select Silver -> Click Ok
Select Red - Scroll down using ▼ of the scrollbar
- Double-click Olive to select and pass to program
- Select Maroon -> Press "Enter" on keyboard
- Click Exit to exit the program
|
|
|
The Program in Action
Why Do It This Way?
...