home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / oop / macapp3 / 399 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  1.2 KB

  1. Path: sparky!uunet!think.com!ames!olivea!apple!applelink.apple.com
  2. From: GER.XSE0158@AppleLink.Apple.COM (Bergmann+Partner,DE,IDV)
  3. Newsgroups: comp.sys.mac.oop.macapp3
  4. Subject: Re: Draw (double)????
  5. Message-ID: <726773100.2867485@AppleLink.Apple.COM>
  6. Date: 11 Jan 93 17:13:00 GMT
  7. Sender: daemon@Apple.COM
  8. Organization: AppleLink Gateway
  9. Lines: 26
  10.  
  11. Hello Bill,
  12.  
  13. You wrote:
  14.  
  15. >     I'm tring to write a (double) into a view for display. Since NumToString
  16. > does only Integer conversion, I've tried the C function ecvt() which crashes
  17. > hard.
  18.  
  19. Unless I can see your code, I will not be able to tell why your code crashes.
  20. But it can be done easily:
  21.  
  22. I do not know in what view you wanted to draw the double. In a simple case I
  23. would use sprintf() to print it in a c-string and the put it into a TStaticText
  24. (which works fine with the CStr255-Constructors):
  25.  
  26. char    buffer [32];    // should be enough
  27. sprintf (buffer,"%Lf",myDouble);
  28. aStaticText -> SetText(buffer,kRedraw);
  29.  
  30. If you want to care about international numbering you should use FormatX2Str().
  31. I Implemented a class TExtendedText which works quite similar to TNumberText
  32. (but has been used only once until now). Mail me if you are interested in
  33. the sources.
  34.  
  35.     Klaus Heck
  36.  
  37.