I haven't done subfiles in a really long time and have forgotten most of what I learned and used (V4R?). We have just upgraded to V5R4. I have found enough documentation to get me up to this point but have been unable to find anything on handling scrolling while preserving user selections.
I have finished creating/testing a page at a time subfile (SFLSIZ=SFLPAG) and I can select multiple rows on the same page. When I pageup or pagedown it clears the selections. I have a DS array to collect user selection in my rpg and currently it is only being populated when the user hits enter.
I have included the primary code (not some of the maintenance routines).
What would be the 'best practice' way of handling the pageup and pagedown process to collect and correctly re-display what the user has selected as they scroll? Can I use the CSRRRN field defined in the DDS to index the DS array as I process scrolling? I also have a 'position to' function. I only want the user options cleared when they refresh or 'first pass'.
I have been using Kevin Vandever's book "Subfiles in RPG IV" to get this far. Is there a better resource?
I have finished creating/testing a page at a time subfile (SFLSIZ=SFLPAG) and I can select multiple rows on the same page. When I pageup or pagedown it clears the selections. I have a DS array to collect user selection in my rpg and currently it is only being populated when the user hits enter.
I have included the primary code (not some of the maintenance routines).
Code:
d ds
d PgGCodDS 1 560
d PgGCodSel 7s 0 Overlay( PgGCodDS ) Dim( 80 )
c DoW ( KeyPressed <> F03 ) and
c ( KeyPressed <> F12 )
c ExSr LoadSflPage
c DoW ( KeyPressed <> F03 ) and
c ( KeyPressed <> F12 )
c Eval SflDspCtl = True
c Eval SflDsp = True
c Eval PgGNamPos = *blanks
c Write WindowRcd
c Write CmdKeyRcd
c Write MsgCtlRcd
c ExFmt SflCtlRcd
c Write RmvWindow
c If NbrRcdsInPg = *zero
c Eval RtnCde = UserCancel
c Return
c EndIf
c Eval KeyPressed = FDSKeyPressed
c Eval CursorPostn = FDSCsrPostn
c If NbrRcdsInPg <> *zero
c ExSr ClrMsgSfl
c EndIf
c Eval PostnCursor = False
c Select
c When ( KeyPressed >= F01 ) and
c ( KeyPressed <= F24 ) or
c KeyPressed = Help
c ExSr PrcsCmdKey
c If ReBuildList
c Eval ReBuildList = False
c Leave
c EndIf
c When ( KeyPressed = Enter ) and
c ( PgGNamPos <> *blanks )
c ExSr PositionList
c Leave
c When KeyPressed = PageUp
c If TopOfList
c Eval MsgId = 'DSP0132'
c ExSr LoadMsgSfl
c Else
c ExSr PrcsPageUp
c Leave
c EndIf
c When KeyPressed = PageDown
c If BtmOfList
c Eval MsgId = 'DSP0131'
c ExSr LoadMsgSfl
c Else
c Eval TopOfList = False
c Leave
c EndIf
c Other
c ExSr PrcsSelection
c If RcdWasSlctd
c Return
c EndIf
c EndSl
c EndDo
c EndDo
c Return
c LoadSflPage BegSr
c ExSr ClrSfl
c Eval SflOpt = *blank
c Eval SflEnd = False
c Eval BtmOfList = False
c Eval NbrRcdsInPg = *zero
c DoW NbrRcdsInPg < SflPag
c Read rSvfPGrp
c If %eof ( SvfPGrp1 )
c Eval BtmOfList = True
c Eval SflEnd = True
c EndIf
c If BtmOfList
c Leave
c EndIf
c Eval NbrRcdsInPg = NbrRcdsInPg + 1
c Eval CsrRRN = CsrRRN + 1
c Write SflRcd
* Save the keys for the top of this page and the last pag
c If NbrRcdsInPg = 1
c Eval LastPagKFld = *blanks
c If KeyPressed = PageDown
c Eval LastPagKFld = TopOfPgKFld
c EndIf
c Eval TopOfPgKFld = PgGNam
c EndIf
c EndDo
c If not BtmOfList
c Read rSvfPGrp
c If %eof ( SvfPGrp1 )
c Eval BtmOfList = True
c Eval SflEnd = True
c Endif
c If not BtmOfList
c ReadP rSvfPGrp
c EndIf
c EndIf
c If NbrRcdsInPg = *zero
c ExSr AddBlkSflRcd
c Eval SflEnd = True
c Eval MsgId = 'DSP0311'
c ExSr SndNoRcdMsg
c EndIf
c EndSr
c PrcsSelection BegSr
c Eval RcdWasSlctd = False
c Eval PgGCodPrm = *all'0'
c Clear PgGCodSel
c ReadC SflRcd
c Eval Index = 1
c DoW not %eof ( SvfPGrpSS )
c If SflOpt <> *blank
c Eval RcdWasSlctd = True
c Eval RtnCde = GoodReturn
c Eval PgGCodSel( Index ) = PgGCod
c Eval Index = Index + 1
c EndIf
c ReadC SflRcd
c EndDo
c If not RcdWasSlctd
c Eval MsgId = 'DSP0281'
c Eval MsgDtaA = 'a'
c Eval MsgDtaB = PrfGrpTxt
c ExSr LoadMsgSfl
c Else
c Eval PgGCodPrm = PgGCodDS
c EndIf
c EndSr
Code:
SFLCSRRRN( &CSRRRN ) A CSRRRN 5S 0H





Comment