|
At the 400 School we use and teach the following method. The display file's File Information Data Structure is updated with the cursor row and column position each time the user presses enter or a function key. Accessing this info is the key to making this work gracefully. In the DDS: Define keyword CSRLOC(H1ROW H1COL), defining H1ROW and H1COL as 3.0 "H"idden fields. 0052.01 A R R01 0052.02 A N30 CSRLOC(H1ROW H1COL) 0053.00 A H1ROW 3S 0H 0054.00 A H1COL 3S 0H In the RPG: Define the display file's File Information Data Structure. 0076.00 FAP0123D CF E WORKSTN INFSR(*PSSR) 0077.00 F INFDS(SCRDS) (or call it whatever you wish) Define SCRDS in your "D" or "I" specs (depending on RPG-IV or RPG/400) 0123.00 D SCRDS DS 512 0124.00 D D$ROW 370 370 0125.00 D D$COL 371 371 Define a data structure to parse out the location 0160.00 D BIN#DS DS INZ 0161.00 D BINCHR 2 2 0162.00 D BINARY 1 2B 0 Then call subroutine $GetCursor, which parses out the Row and Column, and then loads these values to H1ROW and H1COL. At the next EXFMT to the screen the cursor will be located where it was when the user pressed enter. Or, you can manipulate the values yourself. 1582.00 C $GetCursor Begsr 1583.00 * 1584.00 C Clear BINARY 1585.00 C Move D$ROW BINCHR 1586.00 C Z-Add BINARY H1ROW 1587.00 C Move D$COL BINCHR 1588.00 C Z-Add BINARY H1COL 1589.00 C EndSr *** NOTE #1 *** Once you define CSRLOC, you MUST load H1ROW and H1COL with a NON-ZERO value, else the program will error out on the EXFMT. *** NOTE #2 *** Use an Indicator on CSRLOC, and deactivate CSRLOC when you have conditioned another field with DSPATR(PC) - position cursor - since CSRLOC will take precedence over DSPATR(PC), and you want to move the cursor to a field in error when you redisplay. Michael D. Kranz The PowerTech Group Seattle - Kansas City - St. Louis Your AS/400 Technology Source office: 913.888.6699 mobile: 913.488.TECH AS/400 Training:................... http://www.400School.com AS/400 Security Software........ http://www.400Security.com Consulting Services................ http://www.PowertechGroup.com ======================================= -----Original Message----- From: Larry Paque [SMTP:larry@scjins.com] Sent: Thursday, November 04, 1999 4:52 PM To: 'rpg400-l@midrange.com' Subject: Cursor positioning > As of V4R4 IBM still has not given us the ability to position the cursor > to a field by field name, only by row/column or by indicator controlled > DSPATR. DSPATR p-field values don't support cursor positioning, either. > > One obvious solution is a table or a database lookup but we would prefer > to avoid that maintenance issue every time a field is added/moved on the > screen. > > Does anyone have a clean method that avoids the use of indicators? > Somehow determining the row/column of a named field from the display file > object? I'd hate to have to parse the source for it. > > > Larry Paque > Echo Service Company > larry@scjins.com <mailto:larry@scjins.com> > +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.