October 2001
Intermediate to advanced
704 pages
19h 33m
English
/* Copyright (c) 1998-2001, Neil Rhodes and Julie McKeehan neil@pobox.com All rights reserved. From the book "Palm OS Programming (2nd edition)" by O'Reilly. Permission granted to use this file however you see fit. */ #define DO_NOT_ALLOW_ACCESS_TO_INTERNALS_OF_STRUCTS #include <BuildDefines.h> #ifdef DEBUG_BUILD #define ERROR_CHECK_LEVEL ERROR_CHECK_FULL #endif #include <PalmOS.h> #include "Customer.h" #include "Utils.h" #include "SalesRsc.h" #include "Common.h" Boolean gSaveBackup = true; Boolean AskDeleteCustomer(void) { FormPtr form = FrmInitForm(DeleteCustomerForm); UInt16 hitButton; UInt16 ctlIndex; // Set the "save backup" checkbox to its previous setting. ctlIndex = FrmGetObjectIndex(form, DeleteCustomerSaveBackupCheckbox); FrmSetControlValue(form, ctlIndex, gSaveBackup); hitButton = FrmDoDialog(form); if (hitButton == DeleteCustomerOKButton) gSaveBackup = (Boolean) FrmGetControlValue(form, ctlIndex); FrmDeleteForm(form); return (Boolean) (hitButton == DeleteCustomerOKButton); } static Boolean CustomerHandleEvent(EventPtr event) { if (event->eType == ctlSelectEvent && event->data.ctlSelect.controlID == CustomerDeleteButton) { if (!AskDeleteCustomer( )) return true; // Don't bail out if they cancel the Delete dialog box. } return false; } // isNew is true if this is a brand-new customer. void EditCustomerWithSelection(UInt16 recordNumber, Boolean isNew, Boolean *deleted, EventPtr event) { FormPtr form; UInt16 hitButton; Boolean dirty = false; Boolean ...