Source Code

Customer.c

/* 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 ...

Get Palm OS Programming, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.