I was using FrmGetActiveForm to get the form pointer, so I tried using
FrmGetFormPtr and have the same problem. The form pointer looks ok (it has
the right formid and the numObjects property is correct).
I narrowed the problem down to a function that toggles the underlined state
of a field. If I remark out the call to that function, everything works
fine. Here's the code...
void ToggleFieldUnderline(FieldPtr pField, Boolean bState)
{
FieldAttrPtr attrs;
FldGetAttributes(pField, attrs);
attrs->underlined = bState;
FldSetAttributes(pField, attrs);
FldDrawField(field);
}
Am I doing something wrong in this function? The function itself works fine
but, like I wrote, after the initial call to UpdateForm() I can't get the
FrmGetObjectIndex function to return successfully (actually, it does return
a value...65535 I think). What happens is CodeWarrior takes me into some
assembly language and if I keep hitting the Go button, it will eventually
get out. No errors.
I tried including a call to FrmDrawForm before and after the FldDrawField
function call, but it had no effect.
----- Original Message -----
From: "Joe Malone" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Monday, May 27, 2002 2:54 PM
Subject: Re: Object not in form
> --- Jeremy Bradshaw <[EMAIL PROTECTED]> wrote:
> > Does anyone know what causes the following error?
> > Form.c, Line: 1728, Object not in form
>
> FrmGetObjectIndex() gets two arguments: a pointer to a form, and an
> object ID. It looks at every object on the form and returns the index
> of the one that matches the ID. If it can't find a matching object,
> you get the above error.
>
> There are two likely causes:
>
> 1. You used FrmGetActiveForm() to get the form pointer, but the active
> form is not the one that has your object. Some UI elements (Lists, I
> think) have their own forms, so FrmGetActiveForm() may not return the
> form you think it will return. To fix this, use FrmGetFormPtr() to get
> the form pointer.
>
> 2. You are creating form objects dynamically. When you do this, the
> form pointer gets changed because the OS actually creates a new form
> and copies your old objects plus the new one to that new form.
> Therefore, when you use any of the FrmNewWhatever() functions, always
> us the new form pointer afterwards.
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/