In article <8914@palm-dev-forum>, David Fedor <[EMAIL PROTECTED]> wrote:

> >The Palm OS Reference says to use FrmHideObject and FrmShowObject (in
> >certain cases) in the description of FrmSetTitle.
> 
> 
> The docs are wrong about this; I have already told the writers about this
> bug and they'll correct it the next time they open up that chapter.
> 
> In fact, FrmHideObject and FrmShowObject don't know anything about the
> title object, so they're no-ops, even if you do guess the right index for
> the title object.  Their code looks to see what sort of object they're
> being told to show or hide, and there's no case in the switch statements
> for frmTitleObjects.
> 
> And the form will draw its title in FrmDrawForm regardless.  So the short
> answer is that forms don't support hiding their titles.
> 
> -David Fedor
> Palm Developer Support

Thanks for clearing this up. Is there a better (or even supported) way to
work around the graphical artefacts in changing the title with a string of
a different length. I currently use the following function to change the
title. Are there better ways?

Remo Hofer

void FormUpdateTitle(FormPtr formPtr, CharPtr s, Boolean copy) {
    Boolean visible;

    if (FrmGetObjectType(formPtr, 0) == frmTitleObj) {
        
        visible = FrmVisible(formPtr);
        
        // since the work around with FrmHideObject, FrmShowObject doesn't
        // work, we can skip it.
        // if (visible) FrmHideObject(formPtr,  0);

        if (copy) FrmCopyTitle(formPtr, s); else FrmSetTitle(formPtr, s);

        // if (visible) FrmShowObject(formPtr,  0);

        // this work around is not as elegant, but it works at least
        if (visible) {
            RectangleType   rect;
            
            FrmGetFormBounds(formPtr, &rect);
            rect.extent.y = 14; // just erase the top of the form
            WinEraseRectangle(&rect , 0);
            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

Reply via email to