I agree that FrmCopyTitle is a better solution. But there is more than one way to do this, and the alternatives are instructive. The technique of hiding the title, changing it, then showing it again is one that has more general applicability -- you can (and often should) do the same trick with other form objects such as labels, fields, buttons (if you change their label), etc.
-bob mckenzie, palm pdx. -----Original Message----- From: Philip Sheard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 27, 2001 5: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/
