|
Richard, Indicators on a display file are useful for some things cursor positioning and subfile control, but don't waste them on detecting keystrokes. Each of our programs contains /COPY members that includes a definition of the INFDS and named constants for <function> keys. Something like this: FFLPROMD CF E WORKSTN INFDS(INFDS) F SFILE(PR_SFL:Pr_SflRRN) . . . * Copy common definitions /Copy @StdTyp_H /Copy @StdErr_H /COPY @FKeys /COPY @HexConst /COPY @INFDS . . . // Process keystrokes on screen DOW CtlFunct = 'GENERL'; // BldFKey builds list of available <F>keys Exsr CtlBldFKey; // BldUsrSel builds a string to show available options. Exsr Ctl1BldUsrSel; // Write the footer and the message control record. Write FTR; Write MsgCtl; // Position the cursor on the screen Exsr CtlPosCsr; // Write the CTL record Write CTL; // If _PopUp is present, overlay a popup window on the screen. // Otherwise read the record already written above. Select; WHEN Ctl1PopUp = 'DELETE'; Exsr CtlDelete; Other; Read CTL; Exsr CtlClrInd; If @MDT_Is_On; CtlChange = 'Y'; EndIf; EndSl; // Clear the program message queue ClrThisPgmMsgQ( *Omit ); Clear CtlErrFatal; Clear CtlErrWarn; // Screen processing Select; WHEN i_Key = F02; Exsr CtlNxtFmt; WHEN i_Key = F03; Exsr ExitNoSave; WHEN i_Key = F04; Exsr CtlPrompt; WHEN i_Key = F08; Exsr CtlDelete; i_Key = F03; WHEN i_Key = F10; Exsr CtlInquir; WHEN i_Key = F11; Exsr CtlUpdate; WHEN i_Key = F12; Exsr ExitSave; WHEN i_Key = F23; Exsr PgmAtrSet; WHEN i_Key = PageUp; Exsr SflPageUp; WHEN i_Key = PageDn; Exsr SflPageDn; WHEN i_Key = F24; Exsr CtlShowMore; WHEN i_Key = FENTER; Exsr CtlEnter; ELSE; Exsr CtlNoKey; EndSl; EndDo; /COPY members *========================================================= * Name...: @INFDS * Purpose: Information Data Structure for Display files * i_KEY :Hex:value of the function key (See @FKEYS) * i_CURLOC:Bin:cursor location * i_DATALN:Bin:Data length passed to screen * i_SFLRRN:Bin:Subfile relative record# (current) * i_PAGRRN:Bin:Subfile relative record# (first RR# on page) * i_SFLCNT:Bin:Number of records in subfile * i_WINLOC:Bin:Cursor location within window D INFDS DS D i_KEY 369 369 D i_CURLOC 370 371B 0 D i_DATALN 372 375B 0 D i_SFLRRN 376 377B 0 D i_PAGRRN 378 379B 0 D i_SFLCNT 380 381B 0 D i_WINLOC 382 383B 0 *========================================================= * Name...: @FKeys * Purpose: Named hex constants for function keys * Notes..: * <F02> toggle between different formats * <F03> bail out, prompt user if unsaved changes are pending * <F04> display a prompt screen * <F05> refresh the existing screen, abandoning changes * <F06> create a new 'thing', whatever we are working on * <F10> toggle to 'default' mode (usually *INQUIRY) * <F11> toggle to 'update' mode * <F20> display a 'log' of transactions * <F22> display 'properties' of the item being displayed * <F23> alter program behaviour * <F24> exit and save * Log....: * 19Jul00 JEK- Created D F01 C CONST(X'31') D F02 C CONST(X'32') D F03 C CONST(X'33') D F04 C CONST(X'34') D F05 C CONST(X'35') D F06 C CONST(X'36') D F07 C CONST(X'37') D F08 C CONST(X'38') D F09 C CONST(X'39') D F10 C CONST(X'3A') D F11 C CONST(X'3B') D F12 C CONST(X'3C') D F13 C CONST(X'B1') D F14 C CONST(X'B2') D F15 C CONST(X'B3') D F16 C CONST(X'B4') D F17 C CONST(X'B5') D F18 C CONST(X'B6') D F19 C CONST(X'B7') D F20 C CONST(X'B8') D F21 C CONST(X'B9') D F22 C CONST(X'BA') D F23 C CONST(X'BB') D F24 C CONST(X'BC') D FCLEAR C CONST(X'BD') D FENTER C CONST(X'F1') D FHELP C CONST(X'F3') D FROLLD C CONST(X'F4') D FPAGEUP C CONST(X'F4') D FROLLU C CONST(X'F5') D FPAGEDN C CONST(X'F5') D FPRINT C CONST(X'F6') > We are developing a set of Free Form RPG coding standards. (Yes, now. We > are primarily a COBOL shop just moving over to RPG, stepping boldly into > the > 1980's!) I want to get the opinion of the group on a technique for setting > DSPF indicators that was proposed. > > The proposal was to code a data structure for the screen indicators using > the "N" data type and to use variable names that are meaningful. The > technique that I am asking for opinions on is that the group of indicators > can be set or tested by using a string such as: '0010000000100000000". > > I am intentionally not stating my opinion, so as not to affect your > comments. Thanks for your input. Code snips follow. The purpose of this > code it to control which functions keys are available when the screen > displays: > > D DspFInd DS > D FunctionKey 1 24 > D PageDown 25 25N > D Request 28 30 > . > . > . > BEGSR $S0Display; > Request = '100' ; > FunctionKey = '001000000001000000000000' ; > EXSR $SZGET; > EXSR $S1DspFmt; > ENDSR; > > Richard L. Weber | Senior Systems Analyst, TOYS 'ñ' US International | > 973.617.3497 | weberr@xxxxxxxxxxx <mailto:weberr@xxxxxxxxxxx> >
As an Amazon Associate we earn from qualifying purchases.
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.