home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 20779 < prev    next >
Encoding:
Internet Message Format  |  1993-01-06  |  2.2 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsm!cbnewsl!att-out!rutgers!sproul!Sproul
  2. From: Sproul@sproul.sproul.com (Mark Sproul)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: List Manager help wanted
  5. Message-ID: <D2150096.mur2al@sproul.sproul.com>
  6. Date: 5 Jan 93 16:48:10 GMT
  7. Reply-To: Sproul@sproul.sproul.com (Mark Sproul)
  8. Organization: Sproul Consulting
  9. Lines: 56
  10. X-Mailer: uAccess - Macintosh Release: 1.6v1
  11.  
  12.  
  13. In article <1993Jan4.061905.14455@midway.uchicago.edu> (comp.sys.mac.programmer), hd12@ellis.uchicago.edu writes:
  14. > I like to creat a list containing file names, size, date etc. Each entry
  15. > should be in a single cell. After I put file name in the cell using
  16. > LSetCell, I have to add size, date etc. in the same cell. Although I can
  17. > use LAddToCell to do that but that will make the size field not aligned
  18. > vertically. Anyone know an elegent way to handle this? Thank you very much.
  19. > BTW. I am using Think C 5.0.3, have lots of trouble with C and Pascal strings.
  20. > Suppose I have:    Str255 mystring;
  21. > Use: mystring="\p Something "; doesn't work. How could I assign a string to the
  22. > variable mystring?
  23.  
  24. To do what you want, first BEFORE creating the list, set the font
  25. for that list to Monoco.  This will set it to a mono-space font. 
  26. Any other monospace font will work as well.
  27.  
  28. next, with the file name do the following
  29.  
  30.     Str255    fName;    //* i assume you have a Pascal file name
  31.     char    lineBuf[128];
  32.  
  33.  
  34.  
  35.     PtoCstr(fName);
  36.     sprintf(lineBuf, "%-32s", fName);    //* this will put the file
  37. name left justfied in the string, padded with spaces, change the number
  38. as you need.
  39.  
  40.     dataLen    = strlen(lineBuf);
  41.     LSetCell(lineBuf,dataLen, ....etc
  42.  
  43. When you do your LAddToCell(), do it in similar manner.
  44.  
  45. One hint, I just discovered this morning that if the text is longer
  46. than the entire width of the window, it will condense the type to
  47. make it fit.
  48.  
  49. On your other question, as far as I know, Think C does not support,
  50.      mystring="\p Something ";
  51.  
  52. use
  53.     strcpy(mystring, " Something ");
  54.     CtoPstr(mystring);
  55.  
  56. or
  57.     sprintf(mystring, "\p Something ");
  58.  
  59. be sure to 
  60.     #include <string.h>
  61.     #include <stdio.h>
  62. and Link ANSI
  63.  
  64. -----------------------------------------------------
  65. Mark Sproul - KB2ICI - New Jersey
  66. sproul@sproul.com
  67.