Thanks Thomas. Just a few follow ups based on your answers
1 -So for strings I think I'll stick with char * .I have UBYTE in a couple of areas of my code but that was from early stuff when I was reading some example code but from what you said I'm guessing that's not a good idea because I'm mixing 2 slightly different formats.
2 -With AllocMem() and malloc() my concern is that I read that you need to store certain things (images, sound) in chip memory and to do this you would use AllocMem and specify chipmem as one of the parameters. What I was reading implied that malloc would just use any available memory.
3 - Rather than what you recommend i guess I just meant what do you use which you answered. I like MUI probably because its the one I was looking at when everything clicked into how it worked. The only thing I don't like is that some things use hooks and I just can't get my head around how the hooks work. Not so much what is happening within the function but the calls to the hooks themselves. Where the parameters are coming from and how the return values work.
4 - Your string exampels were great. It's kind of what I was thinking but you made it clearer for me.
Kind of related to strings there is one other thing that I was reading that there seems to be a bit of a debate about on different sites and forums so I'd like to know what you think about...
When declaring pointers i've read people say that you shold set them to null or 0. Then when you have freed them you should set them back to null or 0.
Some people say this is a must while others say it isn't important and just causes extra work.
*edit* More relating to the issue I have with hooks. For the mui lists DisplayHook in order to show only 1 column I'm using a hook which is modified from code I found.
So I have
struct Hook disphook;
This I'm guessing is my hook
init_hook(&disphook, (HOOKFUNC)dispfunct, NULL); //call to init hook
void init_hook(struct Hook *hook, HOOKFUNC entry, APTR data) // hook function
{
hook->h_Entry = (HOOKFUNC)HookEntry;
hook->h_SubEntry = (HOOKFUNC)entry;
hook->h_Data = (APTR)data;
}
I guess this is setting up the values in the hook structure. Though I'm not sure what HookEntry is or what data would be expected.
I'm also guessing that the 2nd patameter passed is the function that you would call
LONG dispfunct(struct Hook *hook, const char **array, struct ListItems *item)
{
if (rom)
array[0] = item->Name;
else
array[0] = "\033bName";
return(0);
}
and this is where I really get confused. I call this hook in the MUI List with MUIA_List_DisplayHook, &disphook .
How does it know what array and items are as I don't appear to pass anything to them??