Skip to content

Commit cc4c4ed

Browse files
committed
Template representation: convention Masked field Password
1 parent 3d45051 commit cc4c4ed

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

src/cj_template_tool.e

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ feature -- Change
4444
hb: EV_HORIZONTAL_BOX
4545
lab: EV_LABEL
4646
tf: EV_TEXT_FIELD
47+
tf_passwd: EV_PASSWORD_FIELD
4748
but: EV_BUTTON
4849
table: HASH_TABLE [EV_TEXT_FIELD, STRING_32]
4950
is_creation: BOOLEAN
51+
is_password: BOOLEAN
5052
do
5153
create v
5254
v.set_border_width (3)
@@ -59,24 +61,47 @@ feature -- Change
5961
create lab.make_with_text (d.item.name)
6062
if attached d.item.prompt as p then
6163
lab.set_text (p)
64+
if p.is_case_insensitive_equal ("Password") then
65+
is_password := True
66+
else
67+
is_password := False
68+
end
6269
end
6370
create hb
6471
hb.set_padding_width (3)
65-
create tf
66-
if attached d.item.value as l_val then
67-
if not l_val.is_empty then
68-
is_creation := False
72+
if is_password then
73+
create tf_passwd
74+
if attached d.item.value as l_val then
75+
if not l_val.is_empty then
76+
is_creation := False
77+
end
78+
tf_passwd.set_text (l_val)
79+
else
80+
tf_passwd.remove_text
81+
end
82+
hb.extend (lab)
83+
hb.disable_item_expand (lab)
84+
hb.extend (tf_passwd)
85+
v.extend (hb)
86+
v.disable_item_expand (hb)
87+
table.force (tf_passwd, d.item.name)
88+
else
89+
create tf
90+
if attached d.item.value as l_val then
91+
if not l_val.is_empty then
92+
is_creation := False
93+
end
94+
tf.set_text (l_val)
95+
else
96+
tf.remove_text
6997
end
70-
tf.set_text (l_val)
71-
else
72-
tf.remove_text
98+
hb.extend (lab)
99+
hb.disable_item_expand (lab)
100+
hb.extend (tf)
101+
v.extend (hb)
102+
v.disable_item_expand (hb)
103+
table.force (tf, d.item.name)
73104
end
74-
hb.extend (lab)
75-
hb.disable_item_expand (lab)
76-
hb.extend (tf)
77-
v.extend (hb)
78-
v.disable_item_expand (hb)
79-
table.force (tf, d.item.name)
80105
end
81106
widget.replace (v)
82107
if is_creation then

0 commit comments

Comments
 (0)