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.
Happy Friday! That must be why I'm drawing a blank. I'm using F4 to allow the user to prompt on a number of fields in my dspf (not a sfl) and once they've made their selection from my dropdown window the cursor is returning to the first imput-capable field in the record format. I want the cursor to stay on the prompted field. I can't remember how to do that. I am using RTNCSRLOC in the format to tell me &rcd and &fld.
Any assistance would be greatly appreciated.
Thanks!
Chris
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.
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).
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.
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
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