I think it's useful to understand that a web page doesn't have the same sorts of rows/columns that a 5250 screen would have. A 5250 screen is always (ROWSxCOLS) 80x24 or 132x27. Each spot in this grid is one text cell that can contain one character (letter, number, punctuation, etc.)
Web pages do not work that way. The screen is not divded into rows/columns of text values. Rather, it's divided into pixels, and a given screen is unlimited in size in both height and width. If you exceed the number of pixels across or down the browser window, it simply uses scrollbars to allow an unlimited size screen.
Text, graphics, and widgets are not positioned in predetermined "cells". They can go at any pixel position. They can also go right on top of each other. And when you do use text, it's not a fixed size (or font) you can have many different types of text on the same screen, and they can be at any pixel position (including on top of other text) in the screen.
But, since many (almost all, actually) of Profound logic's customers are converting from green screen, it's important for us to be able to provide some way to achieve backward compatibility with the columns/rows that you had in the old environment. So what we did is add a "cursor column" and "cursor row" property to every widget that you can stop the cursor on. The system doesn't truly detect what column you're on... you have to assign the column number in the widget. (Though, if you convert from a green-screen display file, the converter will automatically populate the "cursor row" and "cursor column" properties after it reads them from the green-screen display file.)
When you bind a field to the "return cursor column" and/or "return cursor row" properties (which are "screen-level" properties... i.e. properties that correspond to the record format rather than an individual widget) then these will be used to return the "cursor column" and "cursor row" values to the program. So if you have a textbox (for example) that has cursor row = 1, cursor column = 10, and the user positions to that textbox and hits ENTER, the RPG program will get "return cursor row = 1" and "return cursor column = 10" in it's bound variables.
But, PUI doesn't really know which row/col the cursor is on. It can't, because it's a web application not a 5250 application. It just returns whatever you coded into the "cursor row/col" properties of the widget. Hope that makes sense.
So here's an example. I created a grid, and I want to know which column and row the user left the cursor on. I build my screen in the visual designer, like this:
- rowcol1.png (28.38 KiB) Viewed 15427 times
Hopefully you can see that I set the "cursor column" to 1 for the first column of the subfile. I also set it to 2 and 3 for the other two columns. So heading A=1, heading B=2, heading C=3. I did this simply by typing 1 into the cursor column attribute of the textbox that's in the first row of column A, typing 2 into the cursor column for the textbox in B, and 3 into the textbox in column C.
To get back the column number into my RPG program, I've bound a variable named "COL" to the "return cursor column" screen property.
- rowcol2.png (7.26 KiB) Viewed 15427 times
To get back the row number into my RPG program, since this is a subfile that can have thousands of rows, I don't want to use the "return cursor row". Instead, I'll use the RRN of the subfile, which I can get with the "cursor record number" property of the subfile itself.
- rowcol3.png (7.58 KiB) Viewed 15427 times
Just for the sake of a simple example, I put output fields at the bottom that I can use to see what row/column were the last time the user hit ENTER. The RPG code simply loads test data into the subfile, and then copies the row/col values to the labels (lblRow, lblCol) at the bottom of the screen.
Code: Select all
H DFTACTGRP(*NO)
FROWCOL CF E WORKSTN EXTDESC('SKTEST/ROWCOL')
F EXTFILE('SKTEST/ROWCOL')
F SFILE(SFL: RRN)
F HANDLER('PROFOUNDUI(HANDLER)')
D RRN S 4 0
/free
ClearSFl = *on;
write REC;
ClearSfl = *off;
RRN = 0;
for RRN = 1 to 1000;
DATA1 = 'COLA' + %Char(rrn);
DATA2 = 'COLB' + %Char(rrn);
DATA3 = 'COLC' + %Char(rrn);
write SFL;
endfor;
dou btnExit = *on;
lblRow = Row;
lblCol = Col;
exfmt REC;
enddo;
*inlr = *on;
When I run this, I can move the cursor to any of the textboxes in the subfile and press enter. The screen then refreshes, showing the row/col that I was at by printing it in the labels at the bottom of the screen.
Does that help you understand it?