Looking for a way to store listbox data
This question is referring to a program I am writing for Windows, but the code I am asking for can be ANSI C.
I have a listbox containing a list of frames in an animation. I want to store some data associating with each frame. The data I want to store is: Frame Number, Frame Delay, X Offset, Y Offset, Loop Count, File Path, File Name
Now I wrote some code that uses a typedef struct to store the data, then I created a new array of them like this:
I then proceeded to read/write from these and using the List Item Number as the index for the imagestruct.
typedef struct animationstructure
The problem I had with this method is that when I delete an item from my ListBox, I now have a gap in my data structure which gives me issues later on down the line in my program. This is not too much of a problem unless enough frames get deleted/added enough and it will eventually cause issues with the program. Now I tried to write code to make this work by using a 2nd struct, and running through a loop and copying data from one to the other then back again without the deleted item in the struct array. The code didn't really work well at all.
So I was hoping somebody could help me out with a method of doing this. I have tried making hidden listboxes, but now I am having the program crashing and for some reason it isn't working properly. On top of that I feel it is an easy way out and I don't feel comfortable storing data in hidden controls. I would rather do it the right way. On top of that it can be optimized if I write the code myself, but not if I use Win32 API calls that do a bunch of drawing and other stuff like that.
Pardon my programming lingo. I was a software engineer for Mac OS and embedded systems up until 2002 and I have taken a career change as a Shipyard Welder. But I am now digging back into the realm of computer programming on Windows and I am hooked all over again.
So anyways, I appreciate any help you guys can give. And understand that my memory is very foggy on programming, so too much technical talk may lose me so try to dumb it down if you don't mind. Examples or actual code will really help.