midrange.com code scratchpad
Name:
Simon Coulter
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
03/27/2010 06:14:33 am
IP:
Logged
Description:
RPG IV source for using UIM panel group with F23=More options
Code:
  1.      H DFTACTGRP(*NO)
  2.      H COPYRIGHT('Example of F23=More options. Public Domain by Simon Coulter.')
  3.      H DEBUG(*YES)
  4.      H DATEDIT(*YMD/)
  5.      H OPTION(*SRCSTMT : *NODEBUGIO)
  6.  
  7.      D QuiOpenDspApp   PR                  EXTPGM('QUIOPNDA')
  8.      D appHandle                      8
  9.      D qualPnlGrp                    20    CONST
  10.      D appScope                      10I 0 CONST
  11.      D exitParmItf                   10I 0 CONST
  12.      D helpFull                       1    CONST
  13.      D errCode                     1024    OPTIONS(*VARSIZE)
  14.  
  15.      D QuiCloseApp     PR                  EXTPGM('QUICLOA')
  16.      D appHandle                      8    CONST
  17.      D closeOption                    1    CONST
  18.      D errCode                     1024    OPTIONS(*VARSIZE)
  19.  
  20.      D QuiDspPnl       PR                  EXTPGM('QUIDSPP')
  21.      D appHandle                      8    CONST
  22.      D function                      10I 0
  23.      D pnlName                       10    CONST
  24.      D redsplyOption                  1    CONST
  25.      D errCode                     1024    OPTIONS(*VARSIZE)
  26.  
  27.      D QuiPutDlgVar    PR                  EXTPGM('QUIPUTV')
  28.      D appHandle                      8    CONST
  29.      D varBuffer                  32767    CONST
  30.      D varBufferLen                  10I 0 CONST
  31.      D varRcdName                    10    CONST
  32.      D errCode                     1024    OPTIONS(*VARSIZE)
  33.  
  34.      D QuiAddListEntry...
  35.      D                 PR                  EXTPGM('QUIADDLE')
  36.      D appHandle                      8    CONST
  37.      D varBuffer                  32767    CONST
  38.      D varBufferLen                  10I 0 CONST
  39.      D varRcdName                    10    CONST
  40.      D listName                      10    CONST
  41.      D listOption                     4    CONST
  42.      D listEntHandle                  4
  43.      D errCode                     1024    OPTIONS(*VARSIZE)
  44.  
  45.       * UIM constants
  46.      D $UI_REDISPLAY_YES...
  47.      D                 C                   CONST('Y')
  48.      D $UI_FULL_HELP_NO...
  49.      D                 C                   CONST('N')
  50.      D $UI_UIM_WAIT_FOREVER...
  51.      D                 C                   CONST(-1)
  52.      D $UI_APP_SCOPE_CALLER...
  53.      D                 C                   CONST(-1)
  54.      D $UI_EXIT_PARM_ITF_STRUCT...
  55.      D                 C                   CONST(0)
  56.      D $UI_FUNC_ENTER...
  57.      D                 C                   CONST(0)
  58.      D $UI_FUNC_EXIT...
  59.      D                 C                   CONST(-4)
  60.      D $UI_FUNC_CANCEL...
  61.      D                 C                   CONST(-8)
  62.      D $UI_LIST_OPT_FIRST...
  63.      D                 C                   CONST('FRST')
  64.      D $UI_CLOSE_OPT_NORMAL...
  65.      D                 C                   CONST('M')
  66.  
  67.      D $F23            C                   CONST(123)
  68.      D $MAX_OPT_ROWS   C                   CONST(5)
  69.  
  70.       *  UIM API declarations
  71.      D appHandle       S              8
  72.      D userFunction    S             10I 0
  73.      D listEntryHandle...
  74.      D                 S             10
  75.  
  76.       *  UIM variable pool declarations
  77.      D varpool         DS
  78.      D   rowOpt                       5I 0
  79.  
  80.      D record1         DS
  81.      D   option                       5I 0
  82.      D   column1                     10
  83.      D   column2                     10
  84.      D   column3                     10
  85.      D   column4                     10
  86.      D   column5                     10
  87.  
  88.       * API error code data structure
  89.      D Qus_Ec          DS                    INZ
  90.      D   Qus_Ec_Bytes_Prov...
  91.      D                               10I 0
  92.      D   Qus_Ec_Bytes_Avail...
  93.      D                               10I 0
  94.      D   Qus_Ec_Excp_Id...
  95.      D                                7
  96.      D   Qus_Ec_Rsvd...
  97.      D                                1
  98.      D   Qus_Ec_Excp_Dta...
  99.      D                              128
  100.  
  101.       /FREE
  102.  
  103.        // Force API errors (during testing)
  104.        Qus_Ec_Bytes_Prov = *ZERO;
  105.  
  106.        // Open the UIM application
  107.        QuiOpenDspApp( appHandle                :
  108.                       'F23MOREOPG*LIBL     '   :
  109.                       $UI_APP_SCOPE_CALLER     :
  110.                       $UI_EXIT_PARM_ITF_STRUCT :
  111.                       $UI_FULL_HELP_NO         :
  112.                       Qus_Ec );
  113.  
  114.        // Set dialogue variables
  115.        //   Force display of first row of options
  116.        rowOpt = 1;
  117.        QuiPutDlgVar( appHandle      :
  118.                      varPool        :
  119.                      %SIZE(varPool) :
  120.                      'VARPOOL'      :
  121.                      Qus_Ec );
  122.  
  123.        // Stick one entry in the list for testing
  124.        option = 0;
  125.        column1 = 'ABCDEFGHIJ';
  126.        column2 = 'KLMNOPQRST';
  127.        column3 = 'UVWXYZ1234';
  128.        column4 = '567890-+=_';
  129.        column5 = '!@#$%^&*()';
  130.        QuiAddListEntry( appHandle          :
  131.                         record1            :
  132.                         %SIZE(record1)     :
  133.                         'RECORD1'          :
  134.                         'LIST'             :
  135.                         $UI_LIST_OPT_FIRST :
  136.                         listEntryHandle    :
  137.                         Qus_Ec );
  138.  
  139.        // Until the user requests exit ...
  140.        DOU ( userFunction = $UI_FUNC_ENTER OR
  141.              userFunction = $UI_FUNC_EXIT  OR
  142.              userFunction = $UI_FUNC_CANCEL );
  143.  
  144.           // Display the UIM panel
  145.           QuiDspPnl( appHandle         :
  146.                      userFunction      :
  147.                      'EXAMPLE'         :
  148.                      $UI_REDISPLAY_YES :
  149.                      Qus_Ec );
  150.  
  151.           // User pressed F23=More options?
  152.           IF ( userFunction = $F23 );
  153.              // Condition next row of options
  154.              /IF DEFINED(*V5R3M0)
  155.              rowOpt += 1;
  156.              /ELSE
  157.              rowOpt = rowOpt + 1;
  158.              /ENDIF
  159.              // If more than the maximum allowed then force first row
  160.              IF ( rowOpt > $MAX_OPT_ROWS );
  161.                rowOpt = 1;
  162.              ENDIF;
  163.              QuiPutDlgVar( appHandle      :
  164.                            varPool        :
  165.                            %SIZE(varPool) :
  166.                            'VARPOOL'      :
  167.                            Qus_Ec );
  168.           ENDIF;
  169.  
  170.        ENDDO;
  171.  
  172.        // Close the UIM application
  173.        QuiCloseApp( appHandle            :
  174.                     $UI_CLOSE_OPT_NORMAL :
  175.                     Qus_Ec );
  176.  
  177.       /END-FREE
  178.  
  179.       * End the program and go home
  180.      C                   SETON                                        LR
  181.      C                   RETURN
  182.  
  183.  
© 2004-2019 by midrange.com generated in 0.007s valid xhtml & css