当前位置:编程学习 > html/css >>

TIPTOP——4GL颜色相关设置

使用测试系统TIPTOP GP3.0

颜色的设置分为单身颜色和单头颜色的设置:

一、单身颜色:
1.首先MAIN函数之前定义一个数组
例如:

[html] 
DEFINE ga_color     DYNAMIC ARRAY OF RECORD 
        c01   STRING,c02   STRING, 
        c03   STRING,c04   STRING, 
        c05   STRING,c06   STRING, 
        c07   STRING,c08   STRING, 
        c09   STRING,c10   STRING, 
        c11   STRING,c12   STRING 
     END RECORD 
2._bp(p_ud) 函数里面:
##setCellAttributes( attarr ARRAY OF RECORD )
##Defines decoration attributes for each cell. (定义每个单元格的属性)
  BEFORE DISPLAY   ##显示之前设置属性
    CALL DIALOG.setCellAttributes(ga_color)
3._fill函数里面
  首先 CALL ga_color.clear()   #清空
  然后 FOREACH 里面 判断并赋值(可以对多个栏位,也可以是某一个栏位)

[html] 
IF g_ta_gja[g_cnt].tc_gja10 >5 AND g_ta_gja[g_cnt].tc_gja10<10 THEN  
   LET ga_color[g_cnt].c01 ="" 
   LET ga_color[g_cnt].c02 ="" 
   LET ga_color[g_cnt].c03 ="" 
   LET ga_color[g_cnt].c04 ="" 
   LET ga_color[g_cnt].c05 ="" 
   LET ga_color[g_cnt].c06 ="" 
   LET ga_color[g_cnt].c07 ="" 
   LET ga_color[g_cnt].c08 ="" 
   LET ga_color[g_cnt].c09 ="" 
   LET ga_color[g_cnt].c10 ="red" 
    LET ga_color[g_cnt].c11 ="" 
    LET ga_color[g_cnt].c12 ="" 
 ELSE IF g_ta_gja[g_cnt].tc_gja10>10 THEN 
   LET ga_color[g_cnt].c01 ="" 
   LET ga_color[g_cnt].c02 ="" 
   LET ga_color[g_cnt].c03 ="" 
   LET ga_color[g_cnt].c04 ="" 
   LET ga_color[g_cnt].c05 ="" 
   LET ga_color[g_cnt].c06 ="" 
   LET ga_color[g_cnt].c07 ="" 
   LET ga_color[g_cnt].c08 ="" 
   LET ga_color[g_cnt].c09 ="" 
   LET ga_color[g_cnt].c10 ="blue" 
    LET ga_color[g_cnt].c11 ="" 
    LET ga_color[g_cnt].c12 ="" 
ELSE 
   LET ga_color[g_cnt].c01 ="" 
   LET ga_color[g_cnt].c02 ="" 
   LET ga_color[g_cnt].c03 ="" 
   LET ga_color[g_cnt].c04 ="" 
   LET ga_color[g_cnt].c05 ="" 
   LET ga_color[g_cnt].c06 ="" 
   LET ga_color[g_cnt].c07 ="" 
   LET ga_color[g_cnt].c08 ="" 
   LET ga_color[g_cnt].c09 ="" 
   LET ga_color[g_cnt].c10 ="green blod" 
    LET ga_color[g_cnt].c11 ="" 
    LET ga_color[g_cnt].c12 ="" 
 END IF  
 END IF 
效果图如下图片:

 

 

二、单头颜色:
1.可以直接在画面档(per档)或者4gl档里面设置颜色
例如:
<1>【per档设置】gja02 = gja02,COLOR=GREEN;(color)
<2>【per档设置】ima26 = ima26,COLOR = RED WHERE ima26>1000;
<3>【per档设置】DATEEDIT  tc_gja03 = tc_gja03,COLOR=GREEN,REVERSE;
<4>【4gl档设置】DISPLAY p_ima01 TO ima01 ATTRIBUTE(BOLD,GREEN)
<5>【4gl档设置】DISPLAY BY NAME g_ima.*  ATTRIBUTE(REVERSE,BOLD,GREEN)
<6>【4gl档设置】CALL cl_set_comp_font_color("ima01,ima02a","RED")
<7>【per档设置】GRID (fontpitch=FIXED)

fontpitch:这个属性定义字符的字体类型作为固定或变量在使用默认字体。
COLOR:
【用途】
The COLOR attribute defines the foreground color of the text displayed by a form element.
【说明】
1.color-name can be: BLACK, BLUE, CYAN, GREEN, MAGENTA, RED, WHITE, and YELLOW.
2.For backward compatibility, color-name can be combined with an intensity keyword: REVERSE, LEFT, BLINK, and UNDERLINE.

COLOR  WHERE :
【用途】
The COLOR WHERE attribute defines a condition to set the foreground color dynamically.
【说明】
1.color-name can be: BLACK, BLUE, CYAN, GREEN, MAGENTA, RED, WHITE, and YELLOW.
2.color-name can also be an intensity keyword: REVERSE, LEFT, BLINK, and UNDERLINE.
3.boolexpr defines a Boolean expression with a restricted syntax.
4.The Boolean expression is automatically evaluated at runtime to check when the color attribute must be set.

效果图如下几张图片:

 

 

 

 

 

********************************************************************************************************************************************

==== Till good is better, but better best

====“我的努力不会停止,敬请期待吧!”My trying hard will go on!Please wait and see!

********************************************************************************************************************************************


 

补充:web前端 , HTML 5 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,