× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Shijith

First off, you're right there are other *INKx indicators for the other
function keys although the *INKa keys don't tend to get used much these days
as there are other ways of identifying which command keys are pressed that
are more readable.

To begin with, you can use keywords CFxx and CAxx in your display file,
where the "xx" is a two digit representation of the function key you want to
use.  For example, CA03 = F3, CF01 = F1.  The difference between CAxx and
CFxx is that the CAxx version does not return the screen data to the program
so you would use it where you don't want to process the screen input, e.g.
F3=Exit, F5=Refresh, etc.  CFxx returns the screen data to the program so
you would use it for things like F1=Help and so on.

The format of the keyword is CAxx(ii 'text') or CFxx(ii 'text') where "ii"
is a response indicator (01 to 99) that is turned on when the function key
is pressed.  I normally have "xx" and "ii" the same, so would code CA03(03
'Exit').  In my program if *IN03 is on then I know F3 was pressed and it's
more readable than *INKC.

To check for Enter being pressed and using these indicators I would code
something along the lines of:

        D Pressed         s              1a   Inz('1')

        C                   Exfmt     Screen

        C                   Select
        C                   When      *In01 = Pressed
        C
        C                     ..do help processing
        C
        C                   When      *In03 = Pressed
        C
        C                     ..do exit processing
        C
        C                   When      *In05 = Pressed
        C
        C                     ...refresh the screen
        C
        C                   Other
        C
        C                     ...enter key pressed
        C
        C                   EndSl

By using a Select structure and coding a when for each of the function keys
I'm using then I know that if the Enter key is pressed it'll be catered for
by the "Other" clause.

Alternatively you can use the VLDCMDKEY keyword in your display file, e.g.
VLDCMDKEY(25 'Enter').  The VLDCMDKEY sets on the response indicator if any
of the valid command keys (as defined in your DDS) except for Enter are
pressed.  If Enter is pressed then the indicator will be set off.  In your
code you could use something like:

        C                   Exfmt     Screen
        C                   If        *In25 = *Off
        C                     ...enter key pressed
        C                   Else
        C                     ...function key pressed
        C                   EndIf

A better way, though, is to use the AID byte in the display files File
Information Data Structure (INFDS).  Position 369 of the INFDS holds a
binary value indicating which function key was pressed.  By using this byte
and appropriate constants defining the binary values, you can remove the
need for any indicators at all and increase readability:

        d Infds           ds

        d Cmd_Key               369    369
        d  Cmd_F1         c                   Const(x'31')
        d  Cmd_F2         c                   Const(x'32')
        d  Cmd_F3         c                   Const(x'33')
        d  Cmd_F4         c                   Const(x'34')
        d  Cmd_F5         c                   Const(x'35')
        d  Cmd_F6         c                   Const(x'36')
        d  Cmd_F7         c                   Const(x'37')
        d  Cmd_F8         c                   Const(x'38')
        d  Cmd_F9         c                   Const(x'39')
        d  Cmd_F10        c                   Const(x'3A')
        d  Cmd_F11        c                   Const(x'3B')
        d  Cmd_F12        c                   Const(x'3C')
        d  Cmd_F13        c                   Const(x'B1')
        d  Cmd_F14        c                   Const(x'B2')
        d  Cmd_F15        c                   Const(x'B3')
        d  Cmd_F16        c                   Const(x'B4')
        d  Cmd_F17        c                   Const(x'B5')
        d  Cmd_F18        c                   Const(x'B6')
        d  Cmd_F19        c                   Const(x'B7')
        d  Cmd_F20        c                   Const(x'B8')
        d  Cmd_F21        c                   Const(x'B9')
        d  Cmd_F22        c                   Const(x'BA')
        d  Cmd_F23        c                   Const(x'BB')
        d  Cmd_F24        c                   Const(x'BC')
        d  Cmd_Clear      c                   Const(x'BD')
        d  Cmd_Enter      c                   Const(x'F1')
        d  Cmd_Help       c                   Const(x'F3')
        d  Cmd_Up         c                   Const(x'F4')
        d  Cmd_Down       c                   Const(x'F5')
        d  Cmd_Print      c                   Const(x'F6')

and then in your calculation specs you can code something like...

        C                   Exfmt     Screen
        C                   If        Cmd_Key = Cmd_enter
        C                     ...enter key pressed
        C                   Else
        C                     ...function key pressed
        C                   EndIf

Hope that helps a bit

All the best

Jonathan


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Shijith_Chand
Sent: 01 September 2005 09:27
To: rpg400-l@xxxxxxxxxxxx
Subject: when user presses ENTER key in Display screen How to detect it
inan RPG program?




Dear all,

            When the user presses F1 key we can capture that in the RPG
program by

            checking the *INKA indicator. Similarly I guess F2 - F24 has
a unique indicator

            associated which can be checked for on/off in the program to
find whether user

            has pressed it.

            My problem is because of the lack any such indicator
associated with the ENTER

            Key .In the program I need to figure out using a single IF
condition whether user

            Has pressed the ENTER key.

            I understand I can do the same by checking all the *INKA -
*INKT indicators and

            If all of them are *OFF it is conclusive that user has
pressed the ENTER key.



            Can anybody please tell me a better/smarter option to this?
May be I am missing out

            On some inbuilt features of handling this condition.



Thanks & Regards,

S.chand







DISCLAIMER:
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.