home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsm!cbnewsl!att-out!rutgers!sproul!Sproul
- From: Sproul@sproul.sproul.com (Mark Sproul)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: List Manager help wanted
- Message-ID: <D2150096.mur2al@sproul.sproul.com>
- Date: 5 Jan 93 16:48:10 GMT
- Reply-To: Sproul@sproul.sproul.com (Mark Sproul)
- Organization: Sproul Consulting
- Lines: 56
- X-Mailer: uAccess - Macintosh Release: 1.6v1
-
-
- In article <1993Jan4.061905.14455@midway.uchicago.edu> (comp.sys.mac.programmer), hd12@ellis.uchicago.edu writes:
- > I like to creat a list containing file names, size, date etc. Each entry
- > should be in a single cell. After I put file name in the cell using
- > LSetCell, I have to add size, date etc. in the same cell. Although I can
- > use LAddToCell to do that but that will make the size field not aligned
- > vertically. Anyone know an elegent way to handle this? Thank you very much.
- >
- > BTW. I am using Think C 5.0.3, have lots of trouble with C and Pascal strings.
- > Suppose I have: Str255 mystring;
- > Use: mystring="\p Something "; doesn't work. How could I assign a string to the
- > variable mystring?
- >
-
- To do what you want, first BEFORE creating the list, set the font
- for that list to Monoco. This will set it to a mono-space font.
- Any other monospace font will work as well.
-
- next, with the file name do the following
-
- Str255 fName; //* i assume you have a Pascal file name
- char lineBuf[128];
-
-
-
- PtoCstr(fName);
- sprintf(lineBuf, "%-32s", fName); //* this will put the file
- name left justfied in the string, padded with spaces, change the number
- as you need.
-
- dataLen = strlen(lineBuf);
- LSetCell(lineBuf,dataLen, ....etc
-
- When you do your LAddToCell(), do it in similar manner.
-
- One hint, I just discovered this morning that if the text is longer
- than the entire width of the window, it will condense the type to
- make it fit.
-
- On your other question, as far as I know, Think C does not support,
- mystring="\p Something ";
-
- use
- strcpy(mystring, " Something ");
- CtoPstr(mystring);
-
- or
- sprintf(mystring, "\p Something ");
-
- be sure to
- #include <string.h>
- #include <stdio.h>
- and Link ANSI
-
- -----------------------------------------------------
- Mark Sproul - KB2ICI - New Jersey
- sproul@sproul.com
-