Sometimes when a subfile that has a fold/unfold feature is filled a page at a time, the subfile will revert back to the default fold/unfold status when the roll keys are pressed. There is a way to stop this.
You can control the way the subfile is filled with an indicator, but the trick is letting the program know if the user pressed the command key to fold or unfold.
The answer to this problem is using the SFLMODE keyword in the control format of the subfile. The keyword is used like this SFLMODE(&FOLD). The &FOLD can be any variable you want to use, but this field name is easy to remember, so we'll use it. You also have to define FOLD as a hidden field in your record. Notice that when using it with the keyword, there is an & in front of it.
Put both the SFLDROP and SFLFOLD keywords in the control format and and condition them with indicators. For this example, we'll use indicator 88.
So if 88 is on SFLDROP(CF06), if N88 then SFLFOLD(CF06). This allows the user to toggle by pressing the F6 key.
Now to the RPG Code.
Initialize the FOLD variable with a 1 or 0, depending on if you want the default mode to be folded or unfolded on the subfile, then right before you WRITE the subfile, move FOLD to *IN88.
This will allow the user to toggle back and forth, roll, and still maintain the view the way they left it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment