Hi Jon,
I have the same function and works perfect. I'm using Codewarrior 6.0 (C
compiler) and PalmOS 3.5, here is my function

/***********************************************************************
 *
 * FUNCTION:    GetObjectPtr
 *
 * DESCRIPTION: This routine returns a pointer to an object in the current
 *              form.
 *
 * PARAMETERS:  objectID (in) - The resource ID of the control to get.
 *
 * RETURNED:    Pointer to the control.
 *
 ***********************************************************************/
static ControlType * GetObjectPtr (UInt16 objectID)
{
 FormPtr frm;

 frm = FrmGetActiveForm ();
 if( frm )
  return ((ControlType *)(FrmGetObjectPtr (frm, FrmGetObjectIndex (frm,
objectID))));
 else
  return NULL;
}

"Jon Zaring" <[EMAIL PROTECTED]> wrote in message
news:32417@palm-dev-forum...
>
> Sorry all, I should have been more descriptive.  I'm using CodeWarrior 6.0
> C++ with the 3.5 SDK.   Int16 is a valid declaration according to the 3.5
> SDK Reference Manual, and the GetObjectPtr is the one presented in the
> stationary.
>
> Thanks again for your help!
>
> Here's the code for GetObjectPtr:
>
> /***********************************************************************
>  *
>  * FUNCTION:    GetObjectPtr
>  *
>  * DESCRIPTION: This routine returns a pointer to an object in the current
>  *              form.
>  *
>  * PARAMETERS:  formId - id of the form to display
>  *
>  * RETURNED:    void *
>  *
>  * REVISION HISTORY:
>  *
>  *
>  ***********************************************************************/
> static void * GetObjectPtr(UInt16 objectID)
> {
>  FormPtr frmP;
>
>  frmP = FrmGetActiveForm();
>  return FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, objectID));
> }
>
> And here is the code from the stationary:
>
> /***********************************************************************
>  *
>  * FUNCTION:    MainFormDoCommand
>  *
>  * DESCRIPTION: This routine performs the menu command specified.
>  *
>  * PARAMETERS:  command  - menu item id
>  *
>  * RETURNED:    nothing
>  *
>  * REVISION HISTORY:
>  *
>  *
>  ***********************************************************************/
> static Boolean MainFormDoCommand(UInt16 command)
> {
>    Boolean handled = false;
>    FormPtr frmP;
>
>    switch (command)
>    {
>  case MainOptionsAboutStarterApp:
>   MenuEraseStatus(0);   // Clear the menu status from the display.
>
>   frmP = FrmInitForm (AboutForm);
>
>   FrmSetActiveForm(frmP);
>
>   CtlSetValue((ControlType *)GetObjectPtr(AboutTestCheckbox),0);
>
>   FrmDoDialog (frmP);   // Display the About Box.
>
>   Int16 iTemp = CtlGetValue((ControlType
*)GetObjectPtr(AboutTestCheckbox));
>
>   // This is the line that doesn't work.
>   CtlSetValue((ControlType *)GetObjectPtr(AboutTestCheckbox),0);
>
>   FrmDoDialog (frmP);   // Display the About Box.
>
>   FrmDeleteForm (frmP);
>   handled = true;
>   break;
>
>  }
>
>    return handled;
> }
>
>
>
>
>



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

Reply via email to