Hi Lance,
you may stick with the standard palm app layout:
There is an EventFunction which receives the event, port them further to
SysHandleEvent and MenuHandleEvent. If the event is a frmLoad Event it
then will install a custom event handler. In this event handler there is
your stuff. For that you would like to handle frmOpen Event to
initialize your form and frmUpdate Event to redraw the form. Like this:
void AppEventLoop(void)
{
UInt16 error;
EventType event;
do
{
/* change timeout if you need periodic nilEvents */
EvtGetEvent(&event, 20);
if (! SysHandleEvent(&event))
{
if (! AppHandleEvent(&event))
{
if (! MenuHandleEvent(0, &event, &error))
{
FrmDispatchEvent(&event);
}
}
}
} while (event.eType != appStopEvent);
}
Boolean AppHandleEvent(EventType* eventP)
{
UInt16 formId;
FormType * frmP= FrmGetActiveForm();
WinHandle formWinH;
if (eventP->eType == frmLoadEvent)
{
/* Load the form resource. */
formId = eventP->data.frmLoad.formID;
frmP = FrmInitForm(formId);
FrmSetActiveForm(frmP);
switch (formId)
{
case BlankForm:
FrmSetEventHandler( frmP, BlankFormHandleEvent
);
break;
}
return true;
}
return false;
}
Boolean BlankFormHandleEvent(EventType * eventP)
{
Boolean handled = false;
FormType* frmP = FrmGetActiveForm();
UInt32 flags, pinMgrVersion;
Err err = errNone;
switch (eventP->eType)
{
case frmOpenEvent:
{
ListType *list;
static Boolean bFirst = true;
SET_FRM_COLORS()
FrmDrawForm(frmP);
etc. pp.
Regards
Henk
Lance Drake wrote:
On Sep 26, 2005, at 10:33 AM, Henk Jonas wrote:
Hm, where do you call your paint function? It's not clear to me from
your post.
Hi Henk,
In the function which serves as the event target for that form there is
a switch on the formID which then can call a simple function like below.
DrawForm()
{
FormPtr frmP;
frmP = FrmGetActiveForm();
if(frmP)
FrmDrawForm (frmP);
}
The point is we never get that far - the app has crashed before the
first line of this code executes.
Thanks for your interest!
Lance Drake
--
-------------------------------------------------------------------------
Henk Jonas [EMAIL PROTECTED]
Palm OS ® certified developer
Please contact me, if you need an off-site contract worker.
-------------------------------------------------------------------------
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/