是否有任何创造性的方法来控制列表框中特定项目的字体颜色?我知道如何将字体颜色发送到列表框中的整个列表,但我很好奇是否可以将其应用于列表中的单个项目。
thx,DJ
如果在表格框中使用col框,则可以获得不同的颜色。 看起来很相似 - 这是一个例子。
n1_list = [1, 2, 3, 4];
c1_list = {"XXX", "YYY", "ZZZ", "WWW"};
tb_list = {};
cb = col box("String1");
for (i = 1, i <= nitems(c1_list), i++,
tb_list[i] = text box(c1_list[i]);
cb << append(tb_list[i]);
);
// Change the color of the third item
tb_list[3] << font color("Red");
nw = new window("Test Color Listbox",
tb = table box(
number col box("Index", n1_list),
cb
)
);
tb << Set Selectable Rows(1);
tb << set row change function(
Function( {this},
row_list = this << get selected rows;
if (nrows(row_list) > 0,
one_row = row_list[1];
show(one_row, c1_list[one_row]);
);
);
);