AS400 RPG DSPF Character Level Color Change

僤鯓⒐⒋嵵緔 提交于 2019-12-13 06:54:03

问题


I want to change the color of individual characters in a field in a subfile.

SCOTT LAWRENCE

JOHN SMITH

I like to show CO in SCOTT as RED color and MI in SMITH in RED color and all other character is GREEN. Can this be achieved ? I am having hard to finding a DSPATR at the individual character level instead of field level in the DSPF. Basically, I want to show characters in a field having values CO and MI in a subfile in a different color.


回答1:


The only way, in 5250 display to show CO in SCOTT as RED color would be to write hexadecimal value within your string, such as: 'S' + x'28' + 'CO' + x'20 + 'TT' (x28:red, x20:normal - cf. http://www.classanova.com/view?id=1382&p=5)

This will change the color but you will also have 1 space for any hexadecimal code: S CO TT

For GUI, you might have better alternatives. Maybe generating an HTML page with the color changes could an option.




回答2:


if your "NAME" field is a fixed length 10 characters, you'd make a data structure for each character...

DS 1 10 NAME

1  1 Name1

2  2 Name2  ... etc.

Then you'd load NAME with your input name SMITH. The name breaks down into individual fields. Use 10 display fields next to each other & define what color they would be. Load the screen fields with your DS fields SName1 = Name1 SName2 = Name2 Display the fields with colors you selected. SName1 SName2 SName3 .....



来源:https://stackoverflow.com/questions/28389175/as400-rpg-dspf-character-level-color-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!