Hi Guys,

I'm trying (in vain) to get my head around exactly what makes a function
legal to put into other segments and what doesn't.

I've got a function called 'AdjustScrollbar' defined like this:

void AdjustScrollbar(FieldPtr fld, ScrollBarPtr scl)
{
        UInt16 scrollPos, textHeight, fieldHeight;

        FldGetScrollValues(fld, &scrollPos, &textHeight, &fieldHeight);
        
        // Update the scrollbar
        if (textHeight > fieldHeight) {
                SclSetScrollBar(scl,scrollPos,0,textHeight-fieldHeight,fieldHeight);
        } else {
                SclSetScrollBar(scl,scrollPos,0,1,fieldHeight);
        }
}

When it's in the default segment, it works perfectly.

When it's in another segment, I get an address error, and it crashes.

It's called from the frmOpenEvent for that form, so the sequence of
actions to get to that point are exactly the same in both cases...

When the function is in the default segment, start up emulator, run
code, go to that form, no problem. When the function is in another
segment, start up emulator, run code, go to that form, *boom*.

Of course, in prc-tools, you cannot debug in another segment, only in
the main segment, so I cannot tell you precisely where the code dies. 
*sigh*

Can anyone explain why such an innocent seeming function would torpedo
my app when run from another segment?

-Ken



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

Reply via email to