Discussion:
Cursor location on subfile (dds/rpg question)
(too old to reply)
Martin Richards
2005-11-09 17:08:18 UTC
Permalink
Hello,
I would like to know what subfile line the cursor is on
when the user presses a command key (i.e. F4=Prompt.)
In DDS RTNCSRLOC only returns record format and
field name which are the same for every subfile line on
the screen?

Martin Richards.
Chris Pando
2005-11-09 18:15:26 UTC
Permalink
Post by Martin Richards
Hello,
I would like to know what subfile line the cursor is on
when the user presses a command key (i.e. F4=Prompt.)
In DDS RTNCSRLOC only returns record format and
field name which are the same for every subfile line on
the screen?
Martin Richards.
I don't know if this helps, but the information is in the File
Information Data Structure



0040.00 fbwaad cf e workstn InfDS(wsDS)
0041.00 f SFile(bwsfl1:saRRNS)


*
* Workstation Information Data Structure
*
d wsDS DS 528
d wsKeyPressed 369 369
d wsCurs 370 371b 0
d wsCursA 370 371a
*

C cursorNum Div 256 row
C Mvr column

Then, if you know the first row, the subfile line is:

sflFrstLine - row + 1

Ugly, but it works.

Chris
--
***@pando.org
www.brilligware.com - Home of MineSweeper 5250
Chris Pando
2005-11-09 18:17:31 UTC
Permalink
Post by Chris Pando
sflFrstLine - row + 1
Durn, hit post when I meant to hit edit.

row - sflFrstLine + 1

Chris 'careless error' Pando
--
Eb
2005-11-09 18:42:35 UTC
Permalink
A SFLCSRRRN(&CURSOR)
A 10 SFLDSP
A 20 SFLDSPCTL
A 30 SFLCLR
A 40 SFLEND(*MORE)
A CURSOR 5S 0H

In your program CURSOR will contain the Relative Record Number of the
Subfile entry the cursor is on when a command key is pressed.

With the RRN you can chain to the specific subfile record that the
user has the cursor on.

However its not the subfile line number that the cursor is on. To get
that you would have to divide the RRN by the number of subfile lines
on a page and use the remainder. Example the user hits a command key
on the 2nd subfile line of the 2nd page of subfile records, 15 line
per page, CURSOR would contain 17.


On Wed, 9 Nov 2005 17:08:18 -0000, "Martin Richards"
Post by Martin Richards
Hello,
I would like to know what subfile line the cursor is on
when the user presses a command key (i.e. F4=Prompt.)
In DDS RTNCSRLOC only returns record format and
field name which are the same for every subfile line on
the screen?
Martin Richards.
B***@lp-gmbh.com
2005-11-10 07:56:09 UTC
Permalink
Hi,

here an example how we solve this problem:
1. Extract from the DDS-File:
A RTNCSRLOC(&C1RCDN &C1FELD)
A CSRLOC(C1CSZE C1CSSP)
A SFLCSRRRN(&C1RSNR)
A SFLMODE(&C1MODE)
A C1RSF 4S 0H SFLRCDNBR(CURSOR)

A C1RSNR 5S 0H

A C1MODE 1A H

A C1RCDN 10A H

A C1FELD 10A H

A C1CSZE 3S 0H TEXT('Cursor-Row for
Positioning')
A C1CSSP 3S 0H TEXT('Cursor-Column for
Positioning')


2. Extract from the RPG-Program:
* File Status Data Structure
D SAVINF DS
D RowHex 370 370I 0
D ColHex 371 371I 0
*-------------------------------------------------------------------
/Free
Exsr DsplySFL

Select;
When AidCode = F04 and C1RSNR <> *Zeros; //F4=Matchcode and
Cursor on Subfile-Record
Chain(E) C1RSNR SFLFMT; //Read Subfile Record
If Not %Error;
exsr Matchcode;
SflNxtChg = *On;
Update(E) SFLFMT;
Endif;
C1RSF = C1RSNR; //Positioning on selected
Subfile-Record
C1CSZE = RowHex; //Postioning on row
C1SCSP = ColHex; //Positioning on column
iter;
endsl;
/End-Free

Birgitta

Loading...