Hi Phil

Are you sure that the first code doesn't work ?
Ther is no need to duplicate the content, as
far as you have the pointer and can access
the contents through it.

The only need of second FrmSetTitle in code 1
is to trigger title redraw. The PalmOS code
might compare the old and new title addresses
and avoid redrawing in case they are same.
This might be an explanation of your case.
Correct me if I am wrong.

I case code1 really doesn't work,
I would try the following trick:

static Char buf[32];
StrCopy(buf, "Philip Sheard");
FrmSetTitle(frm, buf);
StrCopy(buf, "Michael Glickman");
FrmSetTitle(frm, NULL);  // Sic!
FrmSetTitle(frm, buf);

This might work.
Michael


-----Original Message-----
From: Philip Sheard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 28 November 2001 12:26 PM
To: Palm Developer Forum
Subject: Re: FrmSetTitle Usage


FrmCopyTitle does not have the same problem as FrmSetTitle regarding
overlapping text, and indeed the documentation bears this out. To make sure,
I had a look at the source code. I was struck by just how similar the two
routines are. They *both* cater for overlapping. So how come the overlapping
problem only occurs in the latter? The answer is that it does not. It is
just that the original title has to persist until after it has been
replaced.

So this will not work:
static Char buf[32];
StrCopy(buf, "Andy Yeong");
FrmSetTitle(frm, buf);
StrCopy(buf, "Joanne");
FrmSetTitle(frm, buf);

But this will:
static Char buf1[32], buf2[32];
StrCopy(buf1, "Andy Yeong");
FrmSetTitle(frm, buf1);
StrCopy(buf2, "Joanne");
FrmSetTitle(frm, buf2);

Or at least I think it will. I have not checked it, but inspection of
PrvRedrawTitle reveals why it should (and why FrmCopyTitle works). The first
call to FrmSetTitle stores the address of the title, but not its contents.
The second call to FrmSetTitle uses the current contents of that address, to
calculate the length of the original title. In other words, the original
title cannot be discarded until after it has been replaced.

I still think that FrmCopyTitle is a better solution in most instances, as
it obviates the need to allocate temporary storage.




-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to