Problem solve Get help with specific problems with your technologies, process and projects.

View the last cursor position on the screen (Update)

Here are some additional thoughts on ways to view the last cursor position on the screen.

In response to "View the last cursor position on the screen" tip.

The tip presented uses an outdated technic. Now it is much simpler as you will see.

The information relate to:
-RTNCSRLOC (Return Cursor Location) Keyword
-SFLCSRRRN (Subfile Cursor Relative Record Number) Keyword

All the information comes from the IBM manual:

Title: OS/400 DDS Reference V3R2 (Quite old....!!!)
Document Number: SC41-3712-01
Build Date: 03/28/96 09:13:27 Build Version: 1.3.0
Book Path: /home/publib/epubs/book/qbkaui02.boo

RTNCSRLOC (Return Cursor Location) Keyword

-------------------------------------------

The formats of the keyword is:

- Return the name of the record and field in which the cursor is currently positioned. Optionally, a third parameter may be specified that will contain the relative cursor position within the field.

- Return the row and column position of the cursor relative to the display. Optionally, two additional parameters may be provided that will return either the row and column position of the cursor relative to the active window (if one exists) or the location of the cursor at the beginning of the two event mouse button definition.


  RTNCSRLOC([*RECNAME]
              &cursor-record &cursor-field
              [&cursor-position])
                     or
     RTNCSRLOC({*WINDOW | *MOUSE}
              &cursor-row &cursor-column
              [&cursor-row2
              [&cursor-column2]]) 

Sample:

 
 |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
          A          R REC01                     RTNCSRLOC(&RCD &FLD &POS)
          A                                      RTNCSRLOC(*MOUSE &ROW &COL)
          A            FLD           10A  H
          A            RCD           10A  H
          A            POS            4S 0H
          A            FLD1A          2A  I  3  2
          A  10        FLD2A          6A  O  3 18
          A N10        FLD3A         10A  O  3 18
          A*
          A          R REC02                     OVERLAY
          A            FLD1A          2A  I  5  2
          A            FLD2A         10A  O  5  5
          A            FLD3A          6A  O  5 18 

The code is much simpler and it is not affected when you have to move fields due to design change.

 (The code is written V3R2 style)

 * REC01 fields
C           &RCD      IFEQ 'REC01'
C                     SELEC
C           &FLD      WHEQ 'FLD1A'
 *                     some code....
C           &FLD      WHEQ 'FLD2A'
C           &FLD      WHEQ 'FLD3A'
C                     ENDSL
C                     ENDIF
 *
 * REC02 fields
C           &RCD      IFEQ 'REC02'
C                     SELEC
C           &FLD      WHEQ 'FLD1A'
 *                     some code....
C           &FLD      WHEQ 'FLD2A'
C           &FLD      WHEQ 'FLD3A'
C                     ENDSL
C                     ENDIF
  * 

SFLCSRRRN (Subfile Cursor Relative Record Number) Keyword (Another goodie!!!)
-----------------------------------------------------------
Use this record-level keyword on the subfile control record format to return the relative record number of the record on which the cursor is located within a subfile. If the subfile records occupy more than one line, use this keyword in conjunction with the SFLMODE keyword to determine the location of the cursor.

The format of the keyword is:

SFLCSRRRN(&relative-record)

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on RPG iSeries programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close