On 7/17/05, Chris Tutty <[EMAIL PROTECTED]> wrote:
> From: "Layne Lund" <[EMAIL PROTECTED]>
> > values are all static in the resource file. Is there a way to set the
> > column widths at run time instead? Of course, this gets into a whole
> > other mess in trying to calculate the width of a string in a given
> > font, but I can figure out that part later. I need to first know if
> > it's even possible to set the width at run time. (Maybe I should just
> >
> That's actually the easy part. There are a number of good functions
> for determining pixel widths and wrap breaks of text. Example:
>
> // set drawing font
> FntSetFont(g_prefs.Font);
> LstGlueSetFont(GetObjectPtrFromId(frmP, MsgListMessageList), g_prefs.Font);
>
> // Calculate widest column contents (assumes fixed width digits)
> LineOneX = FntCharsWidth("00/00", 5);
>
> I then draw the whole list myself using.
> // Notify Palm OS that we will draw each list item ourselves.
> pList = GetObjectPtrFromId(frmP, MsgListMessageList);
> LstSetDrawFunction(pList, &ListDrawFunc);
>
> and combinations of WinDrawChars() and
> WinDrawLine(LineOneX + 1, etc to do the work. It's a bit fiddly to
> set up, but gives you complete freedom to change the style of the list
> and my experience is that once you're concerned with column widths
> you're likely to start wanting to make all sorts of detailed changes.
> Biting the bullet to go to custom drawing pays off when you're
> fine-tuning the list style.
>
> Chris Tutty
Thanks for the comments. After I posted this message, I checked out
the SDK docs and found TblSetColumnWidth(). I'm not quite to the
point where I want to get down to that much detail in the UI layout,
but it's nice to know that it's there if I need it.
Well, back to coding and figuring out more about the Table control.
Again, thanks for the suggestions.
Layne
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/