Welcome, Guest. Please login or register.

Author Topic: Lists in C  (Read 2053 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline foleyjoTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 608
Lists in C
« on: April 28, 2017, 09:50:23 PM »
Hi

I'm trying to write a program in C but really struggling to understand it. I'm using Storm C 3.0 .

I'm trying to use tutorials in C in general and in Amiga development but not finding many that work for me. What I don't want to do is keep asking questions and then realise that my program is just the work of others copy and pasted so I am reluctant to ask this but I'm just not getting anywhere. I'm also rubbish at explaining what I want but...

I'm basically trying to produce a list box in a window. Making a window is fine it's just the list box I can't do. Well I can do a list box I just can't get it to display the information I want . (Note I haven't picked if I will use Intuition, Reaction or Mui yet. The tutorial I've looked at cover all of them but I'll probably go with the one I get an answer for assuming I get an answer.


What I want is to create a list of structures. I can create a structure but I'm unsure how to then place it into a list.
I know I can use a link list and add a pointer to the next node but I've read there is a LIST type that takes a name and a pointer to the next node. I'm not sure how to use this as I can't find any information on initializing it and adding nodes to it
Once I have my list I want to display a string from the list in the list box (the first string in the structure) and then when I select from the list box it should populate other areas of my window with the rest of the stored values in the structure.

tl:dr
How do I create a list of structures and a list box that allows me to select a structure using 1 of the values in the structure as the display text in the list box?

Sorry for the long post but I've been trying to do this for a couple of days now and I'm at quitting point :(
 

Offline foleyjoTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 608
Re: Lists in C
« Reply #1 on: April 29, 2017, 09:35:42 PM »
Never mind I've managed to work out how to create a list of structures, display them and then free the memory.
Should be able to work out how to make a list box in a window from here.