After adding AboutTestCheckbox, I pasted your code into a new Starter.c and
into a new Starter.cpp and they both worked. What exactly is the error when
"This next line crashes the program"?
From: "Jon Zaring" <[EMAIL PROTECTED]>
> I changed the program so I get the object in the AboutForm, but I still
get
> the error. I also moved the iTemp declaration out of the switch. :)
>
> Here is the code:
>
> static Boolean MainFormDoCommand(UInt16 command)
> {
> Boolean handled = false;
> FormPtr frmP;
> Int16 iTemp;
>
> switch (command)
> {
> case MainOptionsAboutStarterApp:
> MenuEraseStatus(0);
>
> frmP = FrmInitForm (AboutForm);
>
> FrmSetActiveForm(frmP);
>
> // This line works, the control gets set
> CtlSetValue((ControlType *)
> FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, AboutTestCheckbox)),0);
>
> // The control appears as set on the form
> FrmDoDialog (frmP);
>
> // If the checkbox was changed, iTemp reflects the change
> iTemp = CtlGetValue((ControlType *)
> FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, AboutTestCheckbox)));
>
> // This next line crashes the program
> CtlSetValue((ControlType *)
> FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, AboutTestCheckbox)),0);
>
> FrmDoDialog (frmP);
>
> 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/