Hello! I'm making a Task list with a listbox. When a task is completed, a button with an image of a line appears on top of it, marking it as completed. For each of the tasks, I have an invisible button image ready. This works fine:
Code: ags
However, I'm trying to make it a bit more fancy and add categories to it: There is the topic and maybe three tasks under it. Now it can happen that a new task is added inside a topic, using InsertItemAt command. That will move all the listbox items under it nicely, but it will break the button placement, if there already is a completed task below.
My question is how to link my button images to the Listbox items? When the order of the list changes, the buttons placement needs to be updated, but I can't really figure out a good way to do this.
Any ideas? Thanks!
function RemoveTaskListItem(String nameofentry) {
int index;
while (index < lstTaskList.ItemCount) {
// Button with a line appears
if(lstTaskList.Items[index].CompareTo(nameofentry) ==0) {
if(index ==0) btnTaskList_0.Visible = true;
if(index ==1) btnTaskList_1.Visible = true;
if(index ==2) btnTaskList_2.Visible = true;
}
else index ++;
}
}
However, I'm trying to make it a bit more fancy and add categories to it: There is the topic and maybe three tasks under it. Now it can happen that a new task is added inside a topic, using InsertItemAt command. That will move all the listbox items under it nicely, but it will break the button placement, if there already is a completed task below.
My question is how to link my button images to the Listbox items? When the order of the list changes, the buttons placement needs to be updated, but I can't really figure out a good way to do this.
Any ideas? Thanks!