Vida Marcell Posted May 8, 2022 Share Posted May 8, 2022 Quote Link to comment Share on other sites More sharing options...
Vida Marcell Posted May 8, 2022 Author Share Posted May 8, 2022 Now i can add items without commenting out the RemoveItem, but i still get the error message when i want to delete something. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 8, 2022 Share Posted May 8, 2022 Is the program somehow executing the delete event when you click add? Use a break point on bakerlist->RemoveItem(1) to find out. If it is, then after adding one item, its trying to remove index 1 which doesn't exist yet. Not sure why it's trying to remove it though. If you're trying to remove the last element, check if the element you want to remove actually exists in the array. int size = bakerlist->GetSize(); if (size != 0){ bakerlist->RemoveItem(size - 1); } (Not sure what the right syntax is for the widget your using) Quote Link to comment Share on other sites More sharing options...
Josh Posted May 9, 2022 Share Posted May 9, 2022 Indexes start with 0. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.