01-26-2006 10:17 AM
Hi,
I need to write to a TEXT BOX a line of text is a specific color.
I can change ALL text but not just one line that has been written
SetCtrlAttribute (panelHandle, PANEL_ResultsBox, ATTR_TEXT_COLOR, VAL_GREEN);//Line Green
Each line I write will have a different color from the last so when finished the sequence of test each line written to the text box could have a different color.
The list will be reviewed some time later to check the status as defined by the color!!
Is this possible and if yes how?
Thanks for the help
Simon
01-26-2006 10:32 AM - edited 01-26-2006 10:32 AM
Message Edited by Roberto Bozzolo on 01-26-2006 05:39 PM
01-27-2006 03:14 AM
Hi,
And I thought list boxes were difficult but I am coming to grips with them.
GetValueFromIndex (panelHandle, PANEL_LISTBOX, count, &value);
GetLabelFromIndex (panelHandle, PANEL_LISTBOX, count, label);
sprintf (item, "\033fg%06X%s",VAL_RED,label);
InsertListItem (panelHandle, PANEL_ResultsDebugListBox, -1, item, ++line);
CheckListItem (panelHandle, PANEL_LISTBOX, count, 0);
In one list box (LISTBOX) I use for the selection while the second (ResultsDebugListBox) will report the result of the test, colour coded.
Now my problem is to clear at once all the selected items from LISTBOX.
At the moment if items are checked on closing the list box they are still checked when the list box is re-opened at a later stage.
How do I ensure no item is checked the first and every other time the list box is open?
Thanks for the help
Simon
01-27-2006 03:28 AM
There is no mean of clearing items from a listbox depending on the checkmark: you must iterate the list items and delete them one by one.
GetNumListItems (panelHandle, PANEL_LISTBOX, &lines);
for (i = 0; i < lines, i++) {
IsListItemChecked (panelHandle, PANEL_LISTBOX, i, &checked);
if (checked) {
DeleteListItem (panelHandle, PANEL_LISTBOX, i, 1);
lines--;
}
}
But, couldn't you delete them in the same moment in which you are transferring from one list to the second?
01-27-2006 09:42 AM
Hi,
for (i = 0; i < lines; i++)
{
IsListItemChecked (panelHandle, PANEL_LISTBOX, i, &checked);
if (checked)
{
//DeleteListItem (panelHandle, PANEL_LISTBOX, i, 1);
CheckListItem (panelHandle, PANEL_LISTBOX, i, 0);
lines--;
}
}
Changed one bit as it was not the line but just the tic beside the line needed removing.
Also I needed to add a blank line to the end of the list box, as the last tic was not been removed.
Is there any other way around this?
Thanks for the help
Simon
01-27-2006 05:21 PM
04-11-2018 07:07 AM
Thanks, I'll use a listebox