Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Conditionally AppendItem in ListBox

BenjiDev
Participant

Hello, 

 

I am making a trace dialog that outputs trace level, location in code and a custom message. It consists of a listbox and some checkboxes:

 

normal.png

When a checkbox is unchecked items with that trace level should not be displayed in the listbox:

 

abn.png

(The abnormal trace is removed in the above picture)

 

My problem is that it also removes every item that comes after the removed item (in the above case the removed trace was already last so the bug is not noticed). Unchecking debug removes the error and abnormal trace aswell:

 

debug.png

Which is unwanted. Only the debug trace should be removed.

 

What i do in the code is pretty simple right now: When the value of a checkbox is changed i clear the listbox and populate it again based on the value of the checkboxes. So if for example the trace level is info but that checkbox is unchecked that item won't be appended to the listbox:

redraw.png

changed.png

 

I am pretty confident that the logic in the loop is OK but i am not 100%. Any help is appretiated.

1 ACCEPTED SOLUTION

Solution
Oleg
Advocate

Also, insted index of list item, you can use DG::ListBox::BottomItem.
Like:
listBox.SetTabItemText(  DG::ListBox::BottomItem, Teb::.....)

View solution in original post

4 REPLIES 4

leilei
Enthusiast

Hi,Maybe this can help you.

1111.jpg

Thanks so much, now the error is obvious. I was setting the text on indexes that was not even rendered..

Solution
Oleg
Advocate

Also, insted index of list item, you can use DG::ListBox::BottomItem.
Like:
listBox.SetTabItemText(  DG::ListBox::BottomItem, Teb::.....)

View solution in original post

Thanks, i think this is the cleaner way.

 

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!