You may want to check out the GNU Pilot DSK Table HOWTO.  Unfortunately, I
do not know where it is.  So I will take a little from this HOWTO and post
it here...

You can create a function:
void TrimStringToFitCell(char *string, int cell_width_pixels)
{
  if (FntCharsWidth(string, StrLen(string)) > cell_width_pixels)
  {
    cell_width_pixels -= 6;
    do
    {
      string[StrLen(string) - 1] = 0;
    } while (FntCharsWidth(string, StrLen(string)) > cell_width_pixels);
  StrCat(string, "...");
  }
}

And then use this function in your table callback...
....
display_string = "this is a test";
TrimStringToFitCell(display_string, bounds->extent.x - 2);
...


-Marc Campbell
[EMAIL PROTECTED]



-----Original Message-----
From: Brian O'Grady [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 19, 1999 3:25 AM
To: [EMAIL PROTECTED]
Subject: Table, displaying long stri...


Hi All,

    I have a table which displays data much like the built in calendar. I am
having trouble with strings that to not entirely fit in a row. I want to
insert a string of "..." at the max string length -3 to show the user there
is more to the string. Can someone please show me an example of a way to do
this? It's the little things that matter most in life :-).
                        Thank you
                                Brian


Reply via email to