I have written a new pair of programs as the source for the other one went too deep when you included all the calls.
Saved the source to a save file then used the following to get it onto Server:-
CPYTOSTMF FROMMBR('/qsys.lib/robwork2.lib/robsav.file') TOSTMF('/home/robsav')
You will need to put this onto PC/Server somewhere, create a save file ROBSAV on AS400 and use CPYFRMSTMF to get the save file onto AS/400.
Simply recompile everything in the source file:-
2 files:-
XXCUST – Customer Codes – Use DFU to create some records (i.e. FORD Ford Motor Co, CHRY Chrysler etc)
XXCOLR – Customer Colour Codes – see below
The program for maintaining the colours is UPCOLR and this in turn calls F4CUST to prompt for the customer code when adding a new record. I have used the convention we described with F4-able fields yellow and “tick-box” fields Red.
Solution:
The script below will do 3 things:
1. Remove blank lines by bringing fields closer together
2. Turn red input boxes into checkboxes automatically
3. Add prompt buttons beside yellow input fields
This has been tested with the program sent me, and it works great.
This script will go under the /genie/Skins/gradient/ directory on the IFS.
Script:
Code: Select all
function customize() {
hideFKeyNames = false;
separateSubfileLines = false;
detectSubfile = true;
outlineSubfile = false;
enlargeHeadings = false;
stripedSubfile = true;
functionKeyButtons = true;
// Customize Sign-On Screen
if (detectScreen('D_1_22',' Sign On',
'D_2_47','System . . . . . :',
'D_3_47','Subsystem . . . . :',
'D_4_47','Display . . . . . :')) {
hideElements('D_1_22', 'D_2_47', 'D_3_47', 'D_4_47', 'D_2_69', 'D_3_69', 'D_4_69',
'D_8_16', 'D_9_16', 'D_10_16', 'I_8_52', 'I_9_52', 'I_10_52', 'D_24_39');
changeElementValue('D_6_16', ' User:');
changeElementClass('D_6_16', 'BigText');
changeElementValue('D_7_16', 'Password:');
changeElementClass('D_7_16', 'BigText');
setDOMAttribute(document.getElementById("D_7_16"), "transparent", true);
setDOMAttribute(document.getElementById("D_6_16"), "transparent", true);
moveElement('D_6_16', 9, 15);
moveElement('D_7_16', 11, 15);
moveElement('I_6_52', 8.9, 49);
moveElement('I_7_52', 10.9, 49);
var loginButton = newElement(12.7, 49, 'button', 'Login', 'login_button');
loginButton.onclick = function() { pressKey('Enter') };
moveElement('quit_button', 12.7, 57);
changeElementValue('quit_button', 'Exit');
newElement(5, 15, "img", "/images/login.gif", "backdrop_image");
var msg = trim(getElementValue('D_24_0'));
if (msg!='' && alertMsg=='') {
alertMsg = msg;
if (alertMsg.substr(0,3) == 'CPF') alertMsg = alertMsg.substr(8);
if (alertMsg.substr(0,1) == '-') alertMsg = alertMsg.substr(1);
document.getElementById("5250").style.visibility = "";
}
hideElement('D_24_0')
}
else {
// Otherwise place currently signed on user name into header.
var userSpan = document.getElementById("userSpan");
if (userSpan) userSpan.innerHTML = "Welcome " + document.main.user.value;
}
// Customize 132x27 mode
if (displaySize==132 && !useAjax) {
document.getElementById("middle").style.height = "640px";
document.getElementById("5250").style.position = "absolute";
var position = (screen.width - 1060) / 2;
if (position < 0) position = 0;
document.getElementById("5250").style.left = position + "px";
}
sovereignRules();
}
function sovereignRules() {
// Move fields up so that the blank lines on the screen do not show
var rows = [];
var rowAdjust = [];
for (var i = 0; i <= 27; i++) {
rows[i] = false;
rowAdjust[i] = 0;
}
var fields = getInputFields();
var fields2 = getOutputFields();
for (var i = 0; i < fields.length; i++) {
rows[getRow(fields[i])] = true;
}
for (var i = 0; i < fields2.length; i++) {
rows[getRow(fields2[i])] = true;
}
for (var i = 27; i > 0; i = i - 1) {
if (rows[i]) {
for (var j = i - 1; j > 0; j = j - 1) {
if (!rows[j] && !rows[j-1]) {
rowAdjust[i]++;
}
}
}
}
for (var i = 0; i < fields.length; i++) {
var field = fields[i];
var adj = rowAdjust[getRow(field)];
if (adj > 0) {
field.style.top = (parseInt(field.style.top) - adj * multY) + "px";
}
}
for (var i = 0; i < fields2.length; i++) {
var field = fields2[i];
var adj = rowAdjust[getRow(field)];
if (adj > 0) {
field.style.top = (parseInt(field.style.top) - adj * multY) + "px";
}
}
// Process Input Field Rules
for (var i = 0; i < fields.length; i++) {
var field = fields[i];
if (field.tagName == "INPUT" && !field.readOnly) {
var cls = field.className;
if (cls.indexOf("A2C") >= 0) { // turn into a checkbox
field.style.visibility = "hidden";
var checkbox = createNamedElement("input");
checkbox.type = "checkbox";
checkbox.style.position = "absolute";
checkbox.style.left = field.style.left;
checkbox.style.top = field.style.top;
checkbox.style.cursor = "default";
if (field.value == "1") checkbox.checked = true;
function attachCheckboxEvent(field, checkbox) {
checkbox.onclick = function() {
if (checkbox.checked) field.value = "1";
else field.value = "0";
}
}
attachCheckboxEvent(field, checkbox);
field.parentNode.appendChild(checkbox);
}
if (cls.indexOf("A36") >= 0) { // add F4 prompt button
var promptButton = newElement("button", "?");
promptButton.style.left = (parseInt(field.style.left) + field.offsetWidth + 2) + "px";
promptButton.style.top = (parseInt(field.style.top) - 2) + "px";
function attachPromptAction(field, promptButton) {
promptButton.onclick = function() {
field.focus();
pressKey("F4");
}
}
attachPromptAction(field, promptButton);
}
}
}
}