I used PILRIC to generate a basic application.
I have tried to mimic its form loading process to load a second form (not an
about form but a form with handling code), and succeeded.
I tried to get the "about" form to load from the second form (which I had
created) through a menu option, and couldn't seem to get the about form to load
from the form I had created. It still loads from the main form.
There is one difference between the two. The form load event that succeeded
was from the main form created by PILRIC. The other attempt was to load an
"about" form from a form I had created in PILRIC, then copied "about" form
handling procedures from the main form. The "about" form loads from the main
form.
The compiler makes no complaint.
I can provide the form handling code for the form I created, which, looks like
this:
/*
* FUNCTION: TransformerFormDoCommand
*
* DESCRIPTION: This routine performs the menu command specified.
*
* PARAMETERS:
*
* command
* menu item id
*/
static Boolean TransformerFormDoCommand(UInt16 command)
{
Boolean handled = false;
switch (command)
{
case TransAbout:
{
FormType * frmP;
/* Clear the menu status from the display */
MenuEraseStatus(0);
/* Display the About Box. */
frmP = FrmInitForm (AboutForm);
FrmDoDialog (frmP);
FrmDeleteForm (frmP);
handled = true;
break;
}
case Save:
{
Boolean handled = false;
struct Transfor {
char* s;
}Trans;
FormType * frmP;
FieldType * field;
Boolean redraw;
redraw=true;
Trans.s="q";
field = GetObjectPtr(FrmGetObjectIndex(frmP, kVA));
/* Clear the menu status from the display */
MenuEraseStatus(0);
/* Display the Transformer Box. */
frmP = FrmInitForm(TransformerForm);
//Actions taken due to selection of transformer "save"
SetFieldTextfromStr(field, Trans.s, redraw);
//Actions that follow if nothing is done by code
//to save data
FrmDoDialog (frmP);
FrmDeleteForm (frmP);
handled = true;
break;
}
}
return handled;
}
There is a second issue with my attempt to display some text if the user
selects "save". No text is displayed. I am using a routine
(SetFieldTextfromStr(field, Trans.s, redraw)) from a copy of Palm OS
Programming, The Developer's Guide to actually undertake acquisition of the
object handle and placement of the text in the control, which I hesitate to
post given copyright considerations related to the book.
Thanks to anyone who chooses to respond with some helpful insight.
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/