Sergey,
    I had the same question a few weeks ago and here are three of the
responses I had gotten. The idea is check the length of the string before
you put it in the table and if is to long cut it down to size and add "..."
to the end.

1)There is an API in Palm OS 3.1 and later to do this: WinDrawTruncChars.
Before that, you had to do it yourself. The example apps bundled with the
3.0 SDK should have examples of how to do this.



2)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);
...

3)
> 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, "...");
> }
> }
>

You should rather use FntCharsInWidth
-



Hope this helps,                    Brian


----- Original Message -----
From: Sergey Kozlovsky <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 19, 2000 3:58 AM
Subject: Table problem


> I am using Table with two rows for inputing data. But
> I have troubles when
> my string (wich I input) more than length of cell.
> What should I do in this
> case ? I tryed to change row htight in
> fldHeightChangedEvent but my second
> row disappeared. Some source code will be fun !!!
>
> Any suggestions?
> Thanks.
>
>
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
>

Reply via email to