In addition, I have created a class TListBoxItem (derived from Component), which keeps and represents the text information of a list’s element (see an image above). In the class TList pointers on elements of the list are stored inthe private member Array<TListBoxItem*> pRecords;
There are several questions:
Where I must create elements of the list (TListBoxItem*)? In the constructor of TListBox?
What the right way to add elemets to the list?
How I must right delete items from the list, when my application stops? deleteAndZero() or something else?
Well, as I described above, the application isn’t doing nothing especial. 4 items (1 header and 3 elements of the list) with text (see a picture) above. If an item is clicked it became selected / unselected. All.
In a constructor of the class TListBox derived from ListBox and ListBoxModel classes I create a new component (TListBoxItem*) and store the pointer in Array<TListBoxItem*> pRecords; Then I make items visible as we usually do with addAndMakeVisible:
an exception arises at the moment of the programme’s start.
If I transfer the code above in a constructor, an exception arises at the moment of the programme’s end.
What I do incorrectly?