From: jpdelprat AT teaser DOT fr (Jean-Pierre Delprat) Newsgroups: comp.os.msdos.djgpp Subject: Re: JPTUI Listbox Question Date: Thu, 03 Jul 1997 20:14:27 GMT Organization: Guest of France-Teaser Lines: 47 Message-ID: <33bac84b.1187048@news.teaser.fr> References: <1997070221195166662 AT zetnet DOT co DOT uk> NNTP-Posting-Host: ppp2816-ft.teaser.fr To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Tim Lloyd wrote: >Hi, > >This is a simple question for those of you that use the JPTUI >interface libraries. > >I have created my interface, no probs. However I need to read in a >file line by line and add each line to a JPTUI listbox. > >Here is the code for adding items manually: > >TListItem ListBoxItems[]= { > {"Item 1",LI_NOATTR}, > {"Item 2",LI_NOATTR}, > {"Item 3",LI_NOATTR}, > {NULL,LI_NOATTR} >}; >TListBox ListBox (&MainWindow,2,2,20,10,"List Bo~x",ListBoxItems); > >I presume that I need to fill ListBoxItems[] with each line from my >file, however I think that may eat memory (as my text file is quite >large) so loading it directly into the listbox might be a better option. > >However I'm only a beginner with C++, I'd really apreciate some help >with this one as I'm pretty clueless as to where to go from here. > >I'm using JPTUI 3.xx. > >Thanks in advance, Tim Lloyd. > > > TListBox is derived from TSimpleList which is derived from TList. So you can use any method of one of this class. Search for m_add_item and m_insert_item (methods of TSimpleList. I advise that you get the last version (4.0a). The doc has been formatted and I've removed many mistakes. Jeepy Jeepy (Jean-Pierre Delprat) jpdelprat AT teaser DOT fr www.teaser.fr/~jpdelprat (JPTUI home page)