Midrange News for the IBM i Community


Posted by: Chris Proctor
Programmer Analyst
Columbia Sports Company
Portland, OR
Positioning the cursor in a display
has no ratings.
Published: 22 Jun 2012
Revised: 23 Jan 2013 - 1703 days ago
Last viewed on: 22 Sep 2017 (9487 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Positioning the cursor in a display Published by: Chris Proctor on 22 Jun 2012 view comments(5)

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: DaleB
Premium member *
Reading, PA
Comment on: Positioning the cursor in a display
Posted: 5 years 3 months 2 days 4 hours 49 minutes ago

DSPATR(PC), which is position cursor attribute. Need indicators to select where you want it active. If more than one active, it goes to uppermost, leftmost.

The other way is CSRLOC(row-field col-field), where they are both 3S0 hidden fields in the same record format. If both are active, CSRLOC overrides DSPATR(PC).

If you've got a subfile, you can also use SFLRCDNBR(CURSOR), which puts the cursor in the first input-field in the row identified by the SFLRCDNBR field. CSRLOC overrides SFLRCDNBR(CURSOR), too.

Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Positioning the cursor in a display
Posted: 5 years 3 months 2 days 3 hours 32 minutes ago

One place I worked wanted the cursor back where you found it after a prompt.  Had to use the csr-x, csr-y method Dale suggests.  However, we did get complaints when someone had the cursor in the middle of the promptable field and that's where I put it back to.  General user concensus was please put the cursor back at the beginning of the field we just prompted - so we changed to using DSPATR(PC).

Posted by: TFisher
Premium member *
Comment on: Positioning the cursor in a display
Posted: 5 years 2 months 29 days 5 hours 32 minutes ago
Edited: Thu, 28 Jun, 2012 at 06:19:42 (1912 days ago)

Consider removing DSPATR(PC) and creating a function to retrieve row/column for a given field and use the CSRLOC keyword to position the cursor. 

 

My opinion is that DSPATR(PC) should never be used anymore.  There simply is no need to add this type of code to a modern RPG program.

Posted by: melindajwebb
Premium member *
Comment on: Positioning the cursor in a display
Posted: 5 years 1 months 8 days 7 hours 34 minutes ago

I would like to get the code from TFisher for the prRtvRowCol() if at all possible.  Please email me at melindawebb@cableone.net

 

thank you

Posted by: gopf
Premium member *
Tahiti French Polynesi
Comment on: Positioning the cursor in a display
Posted: 5 years 22 days 2 hours 19 minutes ago

Chris, If you want the cursor to stay on the prompted field, the best way is to use the following DDS keywords , no need to create a function or write code.

First RTNCSRLOC will return the name of the field

Second RTNCSRLOC will return cursor location (&NUMLIG &NUMPOS)

CSRLOC must have same fields name spécified in the second RTNCSRLOC (&NUMLIG &NUMPOS)

R A1                                                        
                            CF04                            
                            RTNCSRLOC(&£FORM &£FIELD)       
                            RTNCSRLOC(*MOUSE &NUMLIG &NUMPOS)
                            CSRLOC(NUMLIG     NUMPOS)       
  £FORM        10A  H                                      
  £FIELD        10A  H                                      
  NUMLIG       3S 0H                                      
  NUMPOS      3S 0H