How to set a red background or red text on different lines within the List box?If using
ListboxTemp<< background color("red");
, only the entire List box can change color.
May I ask if it is possible to set a red background or red text on different lines within the List box?
As shown in the picture below.
Different Colored backgroundDifferent Colored backgroundDifferent Colored backgroundDifferent Colored backgroundDifferent Colored backgroundDifferent Colored backgroundDifferent Colored background
Different Colored textDifferent Colored textDifferent Colored textDifferent Colored textDifferent Colored textDifferent Colored textDifferent Colored text
Automation and ScriptingRe: How to set a red background or red text on different lines within the List box?I don't think you can manipulate single items in listbox outside of icons

Re: How to set a red background or red text on different lines within the List box?How should I add an icon?
Re: How to set a red background or red text on different lines within the List box?Scripting Index has an example

Names Default To Here(1);
New Window("Example",
fontobj = lb = List Box(
{{"First Item", "continuous"}, {"Second Item", "ordinal"},
{"Third Item", "nominal"}},
width(200),
max selected(2),
nlines(6)
)
);
As does Scripting Guide Scripting Guide > Display Trees > Construct Custom Windows > Construct Display Boxes for New Windows

Re: How to set a red background or red text on different lines within the List box?I thought it was enough to just provide the index to mark the icon, for example, marking the icon on the 1st and 3rd lines only.
I didn't expect that each item in the list would need an additional set of parentheses to mark the icon.
This way of marking is not very intuitive programmatically.
Re: How to set a red background or red text on different lines within the List box?You are dealing with scripting language, it isn't always very intuitive. You can make wish list items and hope for possible improvements down the line.
To my knowledge you cannot update item in List Box. You can only add and remove items. You could create your own helper function to utilize those capabilities to add icons to specific indices.