Plex 2E

  • 1.  More than two colors for a field in a DSPF

    Posted Apr 25, 2018 09:52 AM

    Any advise or any code out there to allow more than two colors in a DSPF ?  i saw the DDS and colors are controlled by an indicator thuss making it one or the other color but not more than two.  Any help will be appreciated.  Thanks !!



  • 2.  Re: More than two colors for a field in a DSPF

    Posted Apr 27, 2018 05:08 AM

    You can do this using the DSPATR keyword and a "program to system field"

     

    It is fairly messy to do in 2E (it requires user source or RPG program, scan & replace CL, etc), but once set up it does work OK.

     

    https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/rzakc/rzakcmstdfdspat.htm

    First, create a 1 character field in the model to use as the program-to-system field. You will need to be able to set this to an appropriate hexadecimal value (as in the above link) for the relevant colour, for example in an RPG program.

     

    You then add the program to system field to the same screen as the field you want to make various colours, then use a scan and replace program to change the DSPATR on the multi-colour field to use this program-to-system value. This can be attached to the DDS to run automatically after the screen has been generated.

     

    I can probably find some code examples if this helps.

     

    - Bob



  • 3.  Re: More than two colors for a field in a DSPF

    Posted Apr 27, 2018 07:23 AM

    Actually. you can use "device user source" to adjust the fields on the display file.
    You need one piece of user source for the field to be conditioned and one for the prog-sys field:

     

    ) POSITION TO=LAST                                                  
         A                                      DSPATR(&ZRATTR)         

     

     

    ) OVERLAY  BLANK=*                                                  
         A            ZRATTR         1A**P**********************        

     

     

    You will still need user source or an RPG program to set the right hex value for the colour.



  • 4.  Re: More than two colors for a field in a DSPF

    Posted May 23, 2018 02:13 PM

    I'm actually working on a write up that will be part of the next 2e webcast tech tip.  It would allow you to define the screen attributes as a status field in the model with each option defined as a condition (there are around 60 combinations).  This would enable you a greater deal of control over fields.  Either concatenating the condition with data (the condition taking one byte)  similar to the way source code is colored..  Or using Robert's suggestion to create programmable fields on the screen and then being able to move the different conditions into the program field.

     

    E



  • 5.  Re: More than two colors for a field in a DSPF

    Posted May 24, 2018 10:00 AM
      |   view attached

    Here's how we do it.  Once you create the functions, you can reuse the code.  I did a quick document that I attached.

    Attachment(s)