home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / pascal / 4849 < prev    next >
Encoding:
Text File  |  1992-08-13  |  1.4 KB  |  43 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!das.wang.com!wang!news
  3. From: s2861785@techunix.technion.ac.il (Alon Ziv)
  4. Subject: Apparent bug in TurboVision TInputLine
  5. Organization: /u1/023/s2861785/.organization
  6. Date: Fri, 14 Aug 1992 10:24:43 GMT
  7. Message-ID: <S2861785.92Aug14102443@techunix.technion.ac.il>
  8. Sender: news@wang.com
  9. Lines: 32
  10.  
  11. While writing some TVision code, I came up with some rather weird
  12. behaviour in TInputLine's methods. It would seem that TInputLine uses
  13. DataSize in some unexpected ways, so, for instance, if you overload it
  14. to provide (say) LongInt data, and your SetData looks like
  15.  
  16.     procedure TInputLong.SetData(var Rec);
  17.       {-Set data in a TInputLong (**BUGGY**) }
  18.  
  19.       var
  20.         RecAsLongInt: LongInt
  21.                       absolute Rec;
  22.         S: String;
  23.  
  24.       begin {SetData}
  25.         Str(RecAsLongInt: MaxLen, S);
  26.         TInputLine.SetData(S);
  27.       end; {TInputLong.SetData}
  28.  
  29. (Yes, I know this is a little silly to do... Actually, what I had was
  30.  a 'grandchild' of TInputLine using its parent's method, which used
  31.  TInputLine's... )
  32.  
  33. The above code won't work, because TInputLong.DataSize returns
  34. 4=SizeOf(LongInt) and causes TInputLine.SetData to copy just 4 bytes
  35. from S (which probably won't be right...)
  36.  
  37. -az
  38. --
  39. Internet:    s2861785@tx.technion.ac.il               . __
  40.     I'M A STUDENT: When I'm wrong, it's my teacher's fault      _|  /
  41.     (when I'm right, the credit is all mine!)         / | /_
  42.                                 Alon Ziv
  43.