Page 1 of 1

PostPosted: Fri Feb 25, 2005 11:41 am
by awilpert
Hi everybody,

I am new here and just started to code in PocketC.

I have written a small program that deletes all entries in a certain DB category. It is very handy, for instance, when you have 200 memos that you do not need anymore.The problem is that I do not know how I could delete the category itself. There is apparently no function in PocketC to do that. Is there another way? Or do I have to code it natively and let PocketC call the new function?

Thanks for your help and attention,


PostPosted: Thu Mar 03, 2005 3:52 am
by dewey
Deleting a category involves removing the category from the database's app info. You can use dbgetappinfo() to retrieve the app info, at which point you will need to modify it and then call dbsetappinfo(). The app info is defined by the application, but it begins with:

typedef struct {
UInt16 renamedCategories;
Char categoryLabels[16][16];
UInt8 categoryUniqIDs[16];
UInt8 lastUniqID;
UInt8 padding;
} AppInfoType;

See ... ormat.html for full explanation.

PostPosted: Thu Mar 03, 2005 5:37 am
by awilpert
Thanks for the information.

I know now that I will have to call an external function to delete a database's category.



PostPosted: Thu Mar 03, 2005 3:07 pm
by dewey
Perhaps you misunderstood, but this can be done in PocketC. In fact, it will be easier to just do it in PocketC, because there is no OS function for doing this! Your external function would need to modify the app info block in the exact same way that your PocketC function would need to.

PostPosted: Fri Apr 01, 2005 7:44 pm
by awilpert

sorry for responding so late... Yes, you are right, I misunderstood you, for I did not realize that dbgetappinfo() IS indeed a PocketC function. I had been checking the documentation, but somehow I managed to miss the function.

Thanks again for your help and advice. Now I like PocketC even more :-)