Using FrmSetTitle will work, but your intuition that you should do more is quite correct. You have created a memory leak here. You should save your title pointer (easiest as a global) and dispose of the memory referenced on the form close event. You should also null this pointer on form open. If you need to change the title multiple times, then you can dispose of a prior version (if the title pointer global is non-null), create a new one, and give it to the form. The reason to save the title pointer as a global and not just to retrieve it from the form is that you must distinguish between the title given in the resource (whose memory you don't want to free) and ones that you set. (Of course there are other ways to do this, but this seems most direct to me.)
As to your overlapping problem, find the index of the form title object, call FrmHideObject on it prior to changing the title, then FrmShowObject on it after changing the title. To determine the title object's index, use a simple loop (index=0; index<FrmGetNumberOfObjects(); index++). call FrmGetObjectType(), and compare the returned value against a frmTitleObj. When you get a bingo, you will have the title's index. -bob mckenzie, palm pdx -----Original Message----- From: Andy Yeong [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 27, 2001 2:45 PM To: Palm Developer Forum Subject: Re: FrmSetTitle Usage Hi Philip, thanks ! I have tried using FrmCopyTitle instead of FrmSetTitle, however, it still does not work it out (overlapping still exists). After some more hours of struggling with this, I manage to get it work, but I'm not too sure is there any side effects. The following code show how I get that stuff done. --------------------------------------------------------------------------- static void UpdateTitle ( char *database_record) { FormPtr frm; char *titlePtr; MemHandle titleH; titleH = MemHandleNew( StrLen(database_record)+1) ); titlePtr = MemHandleLock(titleH); frm = FrmGetActiveForm(); FrmSetTitle(frm, titlePtr) } --------------------------------------------------------------------------- >From the above code, I find it is kind of dangerous of creating a new memory handle and locking it whenever an update is required without removing the previous one. The user simply browse from page to page, so whenever a user increase to the next page, the title changes. Do you see any memory problem will occured if the user keep on flipping for say 100 pages ? Thanks Best Regards Andy Philip Sheard <[EMAIL PROTECTED]> wrote in message news:69169@palm-dev-forum... > > > Anybody got any idea to dynamically change the title of a form > > well ? > > yeah, FrmCopyTitle. > > > As I have a form which title will change according to the database > > retrieve. > > > > I have no problem in doing that except when the "new title" is shorter > than > > the previous title, the trialing words can still be seen, > > > > For example, > > > > 1st title : Andy Yeong > > 2nd title : Joanneeong (it should be Joanne) > > > > Anybody got any idea to avoid that ? > > yeah, FrmCopyTitle. > > > > -- 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/
