I got frustrated and erased the title only if it was going to by shorter. You could
also get the length in pixels of the text string to be more precise. If erased every
time, the draw routine would only draw the text and not the rounded corners.
pCurTitle = FrmGetTitle(FrmGetActiveForm());
if (StrLen(pCurTitle) > StrLen(Title))
{
RctSetRectangle(&screenRect,0,0,159,14);
WinEraseRectangle(&screenRect,0);
}
FrmCopyTitle (FrmGetActiveForm(),Title);
-----Original Message-----
From: Remo [SMTP:[EMAIL PROTECTED]]
Sent: Thursday, February 17, 2000 10:50 AM
To: Palm Developer Forum
Subject: Re: FrmHideObject and redrawing of title
In article <2110@palm-dev-forum>, Steve <[EMAIL PROTECTED]> wrote:
> It's a heck of a lot easier to use FrmCopyTitle; why bother with
> FrmSetTitle? All you need to do is to make sure the initial title (stored
> in the resource) is as long as you ever want it to be (just pad with
> spaces), and that you never copy in a title that's longer (so
> myNewTitle[maxLength-1]='\0'; or the like). The real advantage of
> FrmCopyTitle is that it makes a copy of your string, so you don't need to
> preserve it, while FrmSetTitle requires that your string is always
> available (e.g., global variable or the like).
You're missing the point here. The problem is not about preferring
FrmCopyTitle over FrmSetTitle. Both behave the same way dealing with
redraws after the change. The old title is not erased and only the text
part of the new title (without the rounded border) is drawn after the
change. This is kind of documented in the new OS 3.5 Reference about
FrmSetTitle (without mentioning the problems of longer titles and their
border). The docs for FrmCopyTitle doesn't mention any problem at all. And
the work around given in the docs (to use FrmHideObject and FrmShowObject)
doesn't work (at least for me).
So, does anybody else see this behaviour and do you have a better work
around other than completly erasing the form and redrawing it (as given
below in my FormUpdateTitle)?
void FormUpdateTitle(FormPtr formPtr, CharPtr s, Boolean copy) {
Boolean visible;
if (FrmGetObjectType(formPtr, 0) == frmTitleObj) {
visible = FrmVisible(formPtr);
if (visible) FrmHideObject(formPtr, 0);
if (copy) FrmCopyTitle(formPtr, s); else FrmSetTitle(formPtr, s);
if (visible) FrmShowObject(formPtr, 0);
/* redraw the form to work around bugs
in FrmCopyTitle and FrmSetTitle */
if (visible) {
WinEraseWindow();
FrmUpdateForm(FrmGetFormId(formPtr) , frmRedrawUpdateCode);
}
}
}
--
Remo <[EMAIL PROTECTED]> / / / /
----------------------------------------- -===(o<0=0=0=0=0=0=0=0>===-
Do NOT remove .nospam from email address! \ \ \ \
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html