home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / pascal / 5223 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  1.4 KB

  1. Path: sparky!uunet!wupost!waikato.ac.nz!canterbury.ac.nz!lincoln.ac.nz!cachoo
  2. Newsgroups: comp.lang.pascal
  3. Subject: Re: TDialog.SetData & Listboxes
  4. Message-ID: <1992Sep7.170606.253@lincoln.ac.nz>
  5. From: cachoo@lincoln.ac.nz
  6. Date: 7 Sep 92 17:06:05 +1200
  7. References: <RTBkqB1w164w@bowker.com>
  8. Lines: 27
  9.  
  10. In article <RTBkqB1w164w@bowker.com>, jnicholson@bowker.com (Jim Nicholson) writes:
  11. > Here's a TVision question.
  12. > I appear to be having a problem getting TDIalog.SetDAta to initialize a
  13. > listbox.  I've got a simple dialog containing a listbox and two buttons. My
  14. > transfer record looks like
  15. >    DataRec : record
  16. >        ListBoxVals : TListBoxRec;
  17. >        end;
  18. > I've defined TListBoxRec as per BI tech support (it's a record containing a
  19. > PString collection and a Word);
  20. ... stuff deleted... 
  21. > This approach works for any control type other than TListBOx.  Can someone
  22. > help?
  23.  
  24. You don't give enough info to determine what the problem is. One possibility
  25. is that you are using an INSTANCE of TCollection, instead of creating a 
  26. DESCENDANT. Since TCollection is an ABSTRACT type, when you call
  27. TListBox.NewList with a Nil argument (which is supposed to delete the list)
  28. funny things can happen. If you have a collection of strings created with NewStr
  29. then you need to create a descendant of TCollection where the FreeItem method
  30. calls DisposeStr. Otherwise only TObject.Done will be called and you'll wind
  31. up with a mess!
  32.  
  33. Hope this helps
  34.    Oscar
  35.  
  36.