ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Problem with Field Exit Handling

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Field Exit Handling

    Hello,

    I've written a DSPF in DDS. In a RPGLE Programme-Code I do a EXFMT on this DSPF. This DSPF has six fields packed(5:2). The user has to write an amount into one of this fields.

    There is a further field called Sum. It's the same DSPF but another record. Now I like to refresh the sum field after the user exits one of the input fields so they can see the sum immediately.
    I know that there is the possibility to ask for the command keys [fp1] to [fp24] and the return key [enter]. But is there any possibility to ask for a [field exit] handling?

    I don't know any command which gives back the [field exit] to the RPGLE-Programme.

    Thank you in advance

    BR

    Matze

    PS.: Maybe it would someone help to understand if i post a code how i would do it in VB or VBA (Excel) by using a UserForm:

    'sum is a field in the UserForm
    Public variable as Double
    Private Sub field_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    variable = Cdbl(field)
    sum = sum + variable
    End Sub

  • #2
    Re: Problem with Field Exit Handling

    You could try the CHECK(ER) or AUTO(RA) keyword on each of the input fields. I don't believe that would work if the user exits the field using the tab key however.

    Comment


    • #3
      Re: Problem with Field Exit Handling

      Matze,

      The basic problem is that the field exit key is not handled by the IBM i. Instead, the entire screen is sent to the terminal (either a PC program like IBM i Access, or an actual 5250 terminal,) and the terminal handles everything that occurs on the screen, including drawing the characters you type into the fields, moving the cursor around, and also keys like field exit, field plus and field minus.

      Since all the processing is happening in the terminal, there's really no way for your RPG program to interact with it.

      Adding a keyword like the ones Brian listed will cause the terminal to automatically "press enter" when you hit field exit in any field where the keyword is defined. So that'll basically submit the whole screen back to your RPG program, and you can then do your logic, but if you want the user to pick up where they left off, you will have to resubmit the screen and position the cursor to the next field, etc. This can be very cumbersome.

      Keep in mind that the 5250 display protocol was designed in the 1960's era, where CPU power was a big problem. Moving all of the processing out to the terminal freed up the main CPU to do other things, making this model extremely efficient. But, by todays standards, 5250 is very antiquated... to do more modern things, you should consider a different display method (if possible), such as using a web page for display. On a web screen it's no problem to have code that runs when the cursor leaves a field, or even to have code on each keypress... and you can still use RPG code to handle the server-side logic.

      Comment


      • #4
        Re: Problem with Field Exit Handling

        Thank you Brian and Scott,

        I see there is no way. Unfortunately I can't use another display method cause it's determined by our company.
        I have to search for another different way. Maybe I give the sum on the next DSPF.

        Thank you again for your detailed answer.

        Greetings

        Matze

        Comment

        Working...
        X