Project

General

Profile

color-check.p

Constantin Asofiei, 04/27/2015 03:47 AM

Download (3.25 KB)

 
1
def var clientGui as log.
2

    
3
clientGui = (session:window-system <> "TTY").
4

    
5
default-window:width-chars = 82.
6

    
7
def var c-title as char format "x(80)".
8
def var x as int.
9
def var menu-desc as char init "bla-bla-bla".
10

    
11
assign x       = integer((50 - length(menu-desc)) / 2)
12
       c-title = " "                                 +
13
                 string("lorem", "x(14)")   +
14
                 string( fill(" ", x) +
15
                         menu-desc, "x(48)") +
16
                 string(today, "99/99/9999")
17
                 " "
18
                 string(time, "hh:mm")
19
                 " ".
20

    
21
form c-title bgcolor 5 fgcolor 6 with frame f-hdr no-labels no-box row 1 size 82 by 4.
22

    
23
function checkColors returns int (input gui as log, input msg as char, input dcol as int, input pfcol as int, input fgcol as int, input bgcol as int).
24
   if gui <>  clientGui then return 0.
25
   
26
   if dcol  <> c-title:dcolor  in frame f-hdr then message msg "dcolor is expected"  dcol  "but is received" c-title:dcolor in frame f-hdr.
27
   if pfcol <> c-title:pfcolor in frame f-hdr then message msg "pfcolor is expected" pfcol "but is received" c-title:pfcolor in frame f-hdr.
28
   if fgcol <> c-title:fgcolor in frame f-hdr then message msg "fgcolor is expected" fgcol "but is received" c-title:fgcolor in frame f-hdr.
29
   if bgcol <> c-title:bgcolor in frame f-hdr then message msg "bgcolor is expected" bgcol "but is received" c-title:bgcolor in frame f-hdr.
30

    
31
   message msg.
32
   pause.
33
end.
34

    
35
checkColors(yes, "default", ?, ?, 6, 5).
36
checkColors(no, "default", ?, ?, ?, ?).
37

    
38
color display message c-title with frame f-hdr.
39
checkColors(yes, "message unrealized", ?, ?, 15, 1).
40
checkColors(no, "message unrealized", 2, ?, ?, ?).
41

    
42
color display normal c-title with frame f-hdr.
43
checkColors(yes, "normal unrealized", ?, ?, 0, 15).
44
checkColors(no, "normal unrealized", 0, ?, ?, ?).
45

    
46
color display input c-title with frame f-hdr.
47
checkColors(yes, "input unrealized", ?, ?, 15, 0).
48
checkColors(no, "input unrealized", 1, ?, ?, ?).
49

    
50
view frame f-hdr.
51
checkColors(yes, "view", ?, ?, 6, 5).
52
checkColors(no, "view", ?, ?, ?, ?).
53

    
54
display c-title with frame f-hdr.
55
checkColors(yes, "display", ?, ?, 6, 5).
56
checkColors(no, "display", ?, ?, ?, ?).
57

    
58
color display message c-title with frame f-hdr.
59
checkColors(yes, "message", ?, ?, 15, 1).
60
checkColors(no, "message", 2, ?, ?, ?).
61

    
62
color display normal c-title with frame f-hdr. 
63
checkColors(yes, "normal", ?, ?, 0, 15).
64
checkColors(no, "normal", 0, ?, ?, ?).
65

    
66
color display input c-title with frame f-hdr. 
67
checkColors(yes, "input", ?, ?, 15, 0).
68
checkColors(no, "input", 1, ?, ?, ?).
69
 
70
c-title:fgcolor = 3.
71
c-title:bgcolor = 4.
72
checkColors(yes, "set attributes gui", ?, ?, 3, 4).
73
checkColors(no, "set attributes gui", 1, ?, ?, ?).
74

    
75
if not clientGui then do:
76
   c-title:dcolor = 3.
77
   c-title:pfcolor = 4.
78
   checkColors(yes, "set attributes chui", ?, ?, 3, 4).
79
   checkColors(no, "set attributes chui", 3, 4, ?, ?).
80
end.
81

    
82
color display input c-title with frame f-hdr. 
83
checkColors(yes, "input 2", ?, ?, 15, 0).
84
checkColors(no, "input 2", 1, 4, ?, ?).
85

    
86
color display message c-title with frame f-hdr. 
87
checkColors(yes, "message 2", ?, ?, 15, 1).
88
checkColors(no, "message 2", 2, 4, ?, ?).
89

    
90
color display normal c-title with frame f-hdr. 
91
checkColors(yes, "normal 2", ?, ?, 0, 15).
92
checkColors(no, "normal 2", 0, 4 , ?, ?).