savepoint; initial support for deleting selected records
This commit is contained in:
		
							parent
							
								
									c512466fc0
								
							
						
					
					
						commit
						8822d6cd45
					
				
					 3 changed files with 532 additions and 163 deletions
				
			
		| 
						 | 
				
			
			@ -14,39 +14,34 @@
 | 
			
		|||
	</ALERT_RESOURCE>
 | 
			
		||||
 | 
			
		||||
	<ALERT_RESOURCE RESOURCE_ID="1100">
 | 
			
		||||
		<ALERT_TYPE> ERROR_ALERT </ALERT_TYPE>
 | 
			
		||||
		<ALERT_TYPE> CONFIRMATION_ALERT </ALERT_TYPE>
 | 
			
		||||
		<HELP_ID> 0 </HELP_ID>
 | 
			
		||||
		<DEFAULT_BUTTON> 0 </DEFAULT_BUTTON>
 | 
			
		||||
		<TITLE> "Scanner Error" </TITLE>
 | 
			
		||||
		<MESSAGE>
 | 
			
		||||
			"There was an error closing the scanner.\n\nYou may need to reset the device."
 | 
			
		||||
		</MESSAGE>
 | 
			
		||||
		<DEFAULT_BUTTON> 1 </DEFAULT_BUTTON>
 | 
			
		||||
		<TITLE> "Are You Sure?" </TITLE>
 | 
			
		||||
		<MESSAGE> "^1" </MESSAGE>
 | 
			
		||||
		<BUTTONS>
 | 
			
		||||
			<TEXT> "OK" </TEXT>
 | 
			
		||||
			<TEXT> "Cancel" </TEXT>
 | 
			
		||||
		</BUTTONS>
 | 
			
		||||
	</ALERT_RESOURCE>
 | 
			
		||||
 | 
			
		||||
	<ALERT_RESOURCE RESOURCE_ID="1200">
 | 
			
		||||
		<ALERT_TYPE> ERROR_ALERT </ALERT_TYPE>
 | 
			
		||||
		<ALERT_TYPE> INFORMATION_ALERT </ALERT_TYPE>
 | 
			
		||||
		<HELP_ID> 0 </HELP_ID>
 | 
			
		||||
		<DEFAULT_BUTTON> 0 </DEFAULT_BUTTON>
 | 
			
		||||
		<TITLE> "Scanner Error" </TITLE>
 | 
			
		||||
		<MESSAGE>
 | 
			
		||||
			"There was an error enabling the scanner.\n\nYou may need to reset the device."
 | 
			
		||||
		</MESSAGE>
 | 
			
		||||
		<TITLE> "FYI" </TITLE>
 | 
			
		||||
		<MESSAGE> "^1" </MESSAGE>
 | 
			
		||||
		<BUTTONS>
 | 
			
		||||
			<TEXT> "OK" </TEXT>
 | 
			
		||||
		</BUTTONS>
 | 
			
		||||
	</ALERT_RESOURCE>
 | 
			
		||||
 | 
			
		||||
	<ALERT_RESOURCE RESOURCE_ID="1300">
 | 
			
		||||
	<ALERT_RESOURCE RESOURCE_ID="1400">
 | 
			
		||||
		<ALERT_TYPE> ERROR_ALERT </ALERT_TYPE>
 | 
			
		||||
		<HELP_ID> 0 </HELP_ID>
 | 
			
		||||
		<DEFAULT_BUTTON> 0 </DEFAULT_BUTTON>
 | 
			
		||||
		<TITLE> "Scanner Error" </TITLE>
 | 
			
		||||
		<MESSAGE>
 | 
			
		||||
			"There was an error opening the scanner.\n\nYou may need to reset the device."
 | 
			
		||||
		</MESSAGE>
 | 
			
		||||
		<MESSAGE> "^1\n\nYou may need to reset the device." </MESSAGE>
 | 
			
		||||
		<BUTTONS>
 | 
			
		||||
			<TEXT> "OK" </TEXT>
 | 
			
		||||
		</BUTTONS>
 | 
			
		||||
| 
						 | 
				
			
			@ -611,6 +606,30 @@
 | 
			
		|||
	<MENU_BAR_RESOURCE RESOURCE_ID="1000" LOCALE="enUS" COMMENT="Main Form">
 | 
			
		||||
		<VISIBLE> TRUE </VISIBLE>
 | 
			
		||||
		<MENUS>
 | 
			
		||||
			<MENU>
 | 
			
		||||
				<TITLE> "Edit" </TITLE>
 | 
			
		||||
				<HIDDEN> FALSE </HIDDEN>
 | 
			
		||||
				<BOUNDS>
 | 
			
		||||
					<LEFT> 0 </LEFT>
 | 
			
		||||
					<TOP> 0 </TOP>
 | 
			
		||||
					<WIDTH> 0 </WIDTH>
 | 
			
		||||
					<HEIGHT> 0 </HEIGHT>
 | 
			
		||||
				</BOUNDS>
 | 
			
		||||
				<TITLE_BOUNDS>
 | 
			
		||||
					<LEFT> 0 </LEFT>
 | 
			
		||||
					<TOP> 0 </TOP>
 | 
			
		||||
					<WIDTH> 0 </WIDTH>
 | 
			
		||||
					<HEIGHT> 0 </HEIGHT>
 | 
			
		||||
				</TITLE_BOUNDS>
 | 
			
		||||
				<MENU_ITEMS>
 | 
			
		||||
					<MENU_ITEM>
 | 
			
		||||
						<ID> 1001 </ID>
 | 
			
		||||
						<TITLE> "Delete Record(s)" </TITLE>
 | 
			
		||||
						<COMMAND> "" </COMMAND>
 | 
			
		||||
						<HIDDEN> FALSE </HIDDEN>
 | 
			
		||||
					</MENU_ITEM>
 | 
			
		||||
				</MENU_ITEMS>
 | 
			
		||||
			</MENU>
 | 
			
		||||
			<MENU COMMENT="MainOptions">
 | 
			
		||||
				<TITLE> "Options" </TITLE>
 | 
			
		||||
				<HIDDEN> FALSE </HIDDEN>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										613
									
								
								src/AppMain.c
									
										
									
									
									
								
							
							
						
						
									
										613
									
								
								src/AppMain.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -110,6 +110,8 @@ Boolean         gBabbo = false;
 | 
			
		|||
//UInt16        gNumRows = 11;
 | 
			
		||||
//MemHandle     gHandles[11][3];
 | 
			
		||||
Int16           gTopVisibleRecord = -1;
 | 
			
		||||
Boolean         scanRecordsSelected[12];
 | 
			
		||||
Int16           eventEnteredRow = -1;
 | 
			
		||||
 | 
			
		||||
// This handle serves the barcode field.
 | 
			
		||||
/* MemHandle       hBarcode; */
 | 
			
		||||
| 
						 | 
				
			
			@ -148,11 +150,17 @@ Boolean         gQuantityTouched;
 | 
			
		|||
 * Type Definitions
 | 
			
		||||
 ************************************************************/
 | 
			
		||||
 | 
			
		||||
/* typedef struct { */
 | 
			
		||||
/*     Char        barcode[15]; */
 | 
			
		||||
/*     Char        cases[4]; */
 | 
			
		||||
/*     Char        units[4]; */
 | 
			
		||||
/* } RatScanDbRecord; */
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    Char        barcode[15];
 | 
			
		||||
    Char        cases[4];
 | 
			
		||||
    Char        units[4];
 | 
			
		||||
} RatScanDbRecord;
 | 
			
		||||
    UInt16      cases;
 | 
			
		||||
    UInt16      units;
 | 
			
		||||
} RattailScanRecord;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/************************************************************
 | 
			
		||||
| 
						 | 
				
			
			@ -180,6 +188,10 @@ static Boolean MainFormDoCommand(UInt16 command);
 | 
			
		|||
// Main Form Table
 | 
			
		||||
static void MainFormLoadTable(TablePtr table, Boolean updateScroll);
 | 
			
		||||
static void DrawCustomTableItem(void* table, Int16 row, Int16 col, RectangleType* bounds);
 | 
			
		||||
/* static void BarcodeSelectItem(Int16 row); */
 | 
			
		||||
static Boolean TableHitTest(TablePtr table, Int16 screenX, Int16 screenY);
 | 
			
		||||
static Int16 TableRowHitTest(TablePtr table, Int16 screenX, Int16 screenY);
 | 
			
		||||
static void ClearScanRecordSelection();
 | 
			
		||||
 | 
			
		||||
static void FocusBarcode();
 | 
			
		||||
#ifdef SCANLIB_SYMBOL
 | 
			
		||||
| 
						 | 
				
			
			@ -295,7 +307,7 @@ static Err AppStart()
 | 
			
		|||
    if (ScanOpenDecoder() == STATUS_OK) {
 | 
			
		||||
        bHaveScanner = true;
 | 
			
		||||
    } else {
 | 
			
		||||
        FrmAlert(AlertScannerOpenError);
 | 
			
		||||
        FrmCustomAlert(AlertScannerError, "There was an error opening the scanner.", "", "");
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -332,7 +344,7 @@ static void AppStop()
 | 
			
		|||
#ifdef SCANLIB_SYMBOL
 | 
			
		||||
    if (bHaveScanner) {
 | 
			
		||||
        if (ScanCloseDecoder() != 0) {
 | 
			
		||||
            FrmAlert(AlertScannerCloseError);
 | 
			
		||||
            FrmCustomAlert(AlertScannerError, "There was an error closing the scanner.", "", "");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -434,10 +446,12 @@ static Boolean AppHandleEvent(EventPtr event)
 | 
			
		|||
 | 
			
		||||
static Boolean MainFormHandleEvent(EventPtr event)
 | 
			
		||||
{
 | 
			
		||||
    Boolean     handled = false;
 | 
			
		||||
    FormPtr     form;
 | 
			
		||||
    TablePtr    table;
 | 
			
		||||
    Boolean             handled = false;
 | 
			
		||||
    FormPtr             form;
 | 
			
		||||
    TablePtr            table;
 | 
			
		||||
    //UInt16      objId;
 | 
			
		||||
    /* Int16               row, r; */
 | 
			
		||||
    Int16               row;
 | 
			
		||||
    
 | 
			
		||||
    form = FrmGetFormPtr(MainForm);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -474,6 +488,63 @@ static Boolean MainFormHandleEvent(EventPtr event)
 | 
			
		|||
        break;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    case penDownEvent:
 | 
			
		||||
        eventEnteredRow = -1;
 | 
			
		||||
 | 
			
		||||
        table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords));
 | 
			
		||||
        if (TableHitTest(table, event->screenX, event->screenY)) {
 | 
			
		||||
 | 
			
		||||
            ClearScanRecordSelection();
 | 
			
		||||
 | 
			
		||||
            row = TableRowHitTest(table, event->screenX, event->screenY);
 | 
			
		||||
            if (row >= 0) {
 | 
			
		||||
                eventEnteredRow = row;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            handled = true;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case penMoveEvent:
 | 
			
		||||
        table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords));
 | 
			
		||||
        if (TableHitTest(table, event->screenX, event->screenY)) {
 | 
			
		||||
 | 
			
		||||
            row = TableRowHitTest(table, event->screenX, event->screenY);
 | 
			
		||||
            if (row >= 0) {
 | 
			
		||||
                if (! scanRecordsSelected[row]) {
 | 
			
		||||
                    scanRecordsSelected[row] = true;
 | 
			
		||||
                    TblMarkRowInvalid(table, row);
 | 
			
		||||
                    TblRedrawTable(table);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            handled = true;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case penUpEvent:
 | 
			
		||||
        if (eventEnteredRow >= 0) {
 | 
			
		||||
            table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords));
 | 
			
		||||
            if (TableHitTest(table, event->screenX, event->screenY)) {
 | 
			
		||||
 | 
			
		||||
                row = TableRowHitTest(table, event->screenX, event->screenY);
 | 
			
		||||
                if (row >= 0) {
 | 
			
		||||
                    if (! scanRecordsSelected[row]) {
 | 
			
		||||
                        scanRecordsSelected[row] = true;
 | 
			
		||||
                        TblMarkRowInvalid(table, row);
 | 
			
		||||
                        TblRedrawTable(table);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                handled = true;
 | 
			
		||||
            }
 | 
			
		||||
 }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case sclEnterEvent:
 | 
			
		||||
        ClearScanRecordSelection();
 | 
			
		||||
        break;
 | 
			
		||||
            
 | 
			
		||||
    case sclRepeatEvent:
 | 
			
		||||
        if (event->data.sclRepeat.newValue > event->data.sclRepeat.value)
 | 
			
		||||
            gTopVisibleRecord += (event->data.sclRepeat.newValue - event->data.sclRepeat.value);
 | 
			
		||||
| 
						 | 
				
			
			@ -605,6 +676,11 @@ static void MainFormInit(FormPtr form)
 | 
			
		|||
    TablePtr    table;
 | 
			
		||||
    Int16       cols, col, rows, row;
 | 
			
		||||
 | 
			
		||||
    // Clear row selection state.
 | 
			
		||||
    for (row = 0; row < 12; row++) {
 | 
			
		||||
        scanRecordsSelected[row] = false;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords));
 | 
			
		||||
    TblHasScrollBar(table, true);
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			@ -641,17 +717,55 @@ static void MainFormInit(FormPtr form)
 | 
			
		|||
 | 
			
		||||
static Boolean MainFormDoCommand(UInt16 command)
 | 
			
		||||
{
 | 
			
		||||
    Boolean     handled = false;
 | 
			
		||||
    Boolean     handled;
 | 
			
		||||
    FormPtr     form;
 | 
			
		||||
    TablePtr    table;
 | 
			
		||||
    DmOpenRef   db;
 | 
			
		||||
    UInt16      row, rowIndex, offset;
 | 
			
		||||
    Boolean     selected;
 | 
			
		||||
 | 
			
		||||
    handled = false;
 | 
			
		||||
 | 
			
		||||
    switch (command) {
 | 
			
		||||
    case MainOptionsAboutStarterApp:
 | 
			
		||||
 | 
			
		||||
    case MainEditDeleteRecords:
 | 
			
		||||
        selected = false;
 | 
			
		||||
        for (row = 0; row < 12; row++) {
 | 
			
		||||
            if (scanRecordsSelected[row]) {
 | 
			
		||||
                selected = true;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (selected) {
 | 
			
		||||
            if (FrmCustomAlert(AlertConfirmation, "Do you really wish to delete the selected record(s)?", "", "") == 0) {
 | 
			
		||||
                form = FrmGetFormPtr(MainForm);
 | 
			
		||||
                table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords));
 | 
			
		||||
                db = OpenScanDatabase();
 | 
			
		||||
                offset = 0;
 | 
			
		||||
                for (row = 0; row < 12; row++) {
 | 
			
		||||
                    if (scanRecordsSelected[row]) {
 | 
			
		||||
                        rowIndex = TblGetRowID(table, row);
 | 
			
		||||
                        DmRemoveRecord(db, rowIndex - offset++);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                DmCloseDatabase(db);
 | 
			
		||||
                MainFormLoadTable(table, true);
 | 
			
		||||
                ClearScanRecordSelection();
 | 
			
		||||
                TblRedrawTable(table);
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        } else {
 | 
			
		||||
            FrmCustomAlert(AlertInformation, "You don't have any records selected for deletion.", "", "");
 | 
			
		||||
        }
 | 
			
		||||
        handled = true;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case MainOptionsAboutRattail:
 | 
			
		||||
        form = FrmInitForm(AboutForm);
 | 
			
		||||
        FrmDoDialog(form);
 | 
			
		||||
        FrmDeleteForm(form);
 | 
			
		||||
        handled = true;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    return handled;
 | 
			
		||||
| 
						 | 
				
			
			@ -666,29 +780,141 @@ static Boolean MainFormDoCommand(UInt16 command)
 | 
			
		|||
 | 
			
		||||
static void DrawCustomTableItem(void* table, Int16 row, Int16 col, RectangleType* bounds)
 | 
			
		||||
{
 | 
			
		||||
    Char *      text;
 | 
			
		||||
    UInt16      size;
 | 
			
		||||
    Char*       barcode;
 | 
			
		||||
    Char        quantity[4];
 | 
			
		||||
    Coord       x;
 | 
			
		||||
 | 
			
		||||
    text = (Char *) TblGetItemPtr(table, row, col);
 | 
			
		||||
    if (*text != 0) {
 | 
			
		||||
        size = StrLen(text);
 | 
			
		||||
    if (col == 0) {
 | 
			
		||||
        barcode = (Char*) TblGetItemPtr(table, row, col);
 | 
			
		||||
        WinDrawChars(barcode, StrLen(barcode), bounds->topLeft.x, bounds->topLeft.y);
 | 
			
		||||
 | 
			
		||||
        if (col == 0) { // barcode
 | 
			
		||||
            WinDrawChars(text, size, bounds->topLeft.x, bounds->topLeft.y);
 | 
			
		||||
    } else {
 | 
			
		||||
        StrIToA(quantity, TblGetItemInt(table, row, col));
 | 
			
		||||
        x = bounds->topLeft.x + bounds->extent.x - FntCharsWidth(quantity, StrLen(quantity));
 | 
			
		||||
        WinDrawChars(quantity, StrLen(quantity), x, bounds->topLeft.y);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        } else { // cases or units
 | 
			
		||||
    if (scanRecordsSelected[row]) {
 | 
			
		||||
        WinInvertRectangle(bounds, 0);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
            // Only draw value if nonzero.
 | 
			
		||||
            if (StrCompareAscii(text, "0") != 0) {
 | 
			
		||||
/* static void DrawCustomTableItem(void* table, Int16 row, Int16 col, RectangleType* bounds) */
 | 
			
		||||
/* { */
 | 
			
		||||
/*     Char*       text; */
 | 
			
		||||
/*     UInt16      size; */
 | 
			
		||||
/*     Coord       x; */
 | 
			
		||||
    
 | 
			
		||||
                // Draw value right-aligned.
 | 
			
		||||
                x = bounds->topLeft.x + bounds->extent.x - FntCharsWidth(text, size);
 | 
			
		||||
                WinDrawChars(text, size, x, bounds->topLeft.y);
 | 
			
		||||
/*     text = (Char*) TblGetItemPtr(table, row, col); */
 | 
			
		||||
/*     if (*text != 0) { */
 | 
			
		||||
/*         size = StrLen(text); */
 | 
			
		||||
        
 | 
			
		||||
/*         if (col == 0) { // barcode */
 | 
			
		||||
/*             WinDrawChars(text, size, bounds->topLeft.x, bounds->topLeft.y); */
 | 
			
		||||
 | 
			
		||||
/*         } else { // cases or units */
 | 
			
		||||
 | 
			
		||||
/*             /\* // Only draw value if nonzero. *\/ */
 | 
			
		||||
/*             /\* if (StrCompareAscii(text, "0") != 0) { *\/ */
 | 
			
		||||
                
 | 
			
		||||
/*             /\*     // Draw value right-aligned. *\/ */
 | 
			
		||||
/*             /\*     x = bounds->topLeft.x + bounds->extent.x - FntCharsWidth(text, size); *\/ */
 | 
			
		||||
/*             /\*     WinDrawChars(text, size, x, bounds->topLeft.y); *\/ */
 | 
			
		||||
/*             /\* } *\/ */
 | 
			
		||||
 | 
			
		||||
/*             /\* if (StrCompareAscii(text, "0") == 0) { *\/ */
 | 
			
		||||
/*             /\*     WinDrawChars(" ", 1, bounds->topLeft.x, bounds->topLeft.y); *\/ */
 | 
			
		||||
/*             /\* } else { *\/ */
 | 
			
		||||
/*                 x = bounds->topLeft.x + bounds->extent.x - FntCharsWidth(text, size); */
 | 
			
		||||
/*                 WinDrawChars(text, size, x, bounds->topLeft.y); */
 | 
			
		||||
/*             /\* } *\/ */
 | 
			
		||||
/*         } */
 | 
			
		||||
 | 
			
		||||
/*         // Invert item if row is selected. */
 | 
			
		||||
/*         if (scanRecordsSelected[row]) { */
 | 
			
		||||
/*             WinInvertRectangle(bounds, 0); */
 | 
			
		||||
/*         } */
 | 
			
		||||
/*     } */
 | 
			
		||||
/* } */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/************************************************************
 | 
			
		||||
 *
 | 
			
		||||
 * FUNCTION:    ClearScanRecordSelection
 | 
			
		||||
 *
 | 
			
		||||
 ************************************************************/
 | 
			
		||||
 | 
			
		||||
static void ClearScanRecordSelection()
 | 
			
		||||
{
 | 
			
		||||
    FormPtr     form;
 | 
			
		||||
    TablePtr    table;
 | 
			
		||||
    Int16       row;
 | 
			
		||||
    Boolean     dirty = false;
 | 
			
		||||
 | 
			
		||||
    form = FrmGetFormPtr(MainForm);
 | 
			
		||||
    table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords));
 | 
			
		||||
 | 
			
		||||
    for (row = 0; row < 12; row++) {
 | 
			
		||||
        if (scanRecordsSelected[row]) {
 | 
			
		||||
            scanRecordsSelected[row] = false;
 | 
			
		||||
            TblMarkRowInvalid(table, row);
 | 
			
		||||
            dirty = true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (dirty) {
 | 
			
		||||
        TblRedrawTable(table);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/************************************************************
 | 
			
		||||
 *
 | 
			
		||||
 * FUNCTION:    TableHitTest
 | 
			
		||||
 *
 | 
			
		||||
 ************************************************************/
 | 
			
		||||
 | 
			
		||||
static Boolean TableHitTest(TablePtr table, Int16 screenX, Int16 screenY)
 | 
			
		||||
{
 | 
			
		||||
    RectangleType       bounds;
 | 
			
		||||
 | 
			
		||||
    TblGetBounds(table, &bounds);
 | 
			
		||||
 | 
			
		||||
    if ((screenX >= bounds.topLeft.x) && (screenX <= (bounds.topLeft.x + bounds.extent.x))
 | 
			
		||||
        && (screenY >= bounds.topLeft.y) && (screenY <= (bounds.topLeft.y + bounds.extent.y))) {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/************************************************************
 | 
			
		||||
 *
 | 
			
		||||
 * FUNCTION:    TableRowHitTest
 | 
			
		||||
 *
 | 
			
		||||
 ************************************************************/
 | 
			
		||||
 | 
			
		||||
static Int16 TableRowHitTest(TablePtr table, Int16 screenX, Int16 screenY)
 | 
			
		||||
{
 | 
			
		||||
    RectangleType       bounds;
 | 
			
		||||
    Int16               row, col;
 | 
			
		||||
 | 
			
		||||
    for (row = 0; row < 12; row++) {
 | 
			
		||||
        if (! TblRowUsable(table, row))
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        for (col = 0; col < 3; col++) {
 | 
			
		||||
            TblGetItemBounds(table, row, col, &bounds);
 | 
			
		||||
 | 
			
		||||
            if ((screenX >= bounds.topLeft.x) && (screenX <= (bounds.topLeft.x + bounds.extent.x))
 | 
			
		||||
                && (screenY >= bounds.topLeft.y) && (screenY <= (bounds.topLeft.y + bounds.extent.y))) {
 | 
			
		||||
                return row;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
            
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -701,57 +927,132 @@ static void DrawCustomTableItem(void* table, Int16 row, Int16 col, RectangleType
 | 
			
		|||
static void MainFormLoadTable(TablePtr table, Boolean updateScroll)
 | 
			
		||||
{
 | 
			
		||||
    DmOpenRef           db;
 | 
			
		||||
    UInt16              numRecords;
 | 
			
		||||
    UInt16              records, recordIndex;
 | 
			
		||||
    Int16               rows, row;
 | 
			
		||||
    RattailScanRecord*  recordP;
 | 
			
		||||
    MemHandle           recordH;
 | 
			
		||||
    RatScanDbRecord*    recordP;
 | 
			
		||||
    UInt16              rows, row, rowId;
 | 
			
		||||
    FormPtr             form;
 | 
			
		||||
    ScrollBarPtr        scroll;
 | 
			
		||||
 | 
			
		||||
    db = OpenScanDatabase();
 | 
			
		||||
    if (db == NULL)
 | 
			
		||||
        return;
 | 
			
		||||
    records = DmNumRecords(db);
 | 
			
		||||
 | 
			
		||||
    numRecords = DmNumRecords(db);
 | 
			
		||||
    rows = (numRecords < 12) ? numRecords : 12;
 | 
			
		||||
    if (gTopVisibleRecord < 0)
 | 
			
		||||
        gTopVisibleRecord = (numRecords > 12) ? (numRecords - 12) : 0;
 | 
			
		||||
    if (gTopVisibleRecord < 0) {
 | 
			
		||||
        gTopVisibleRecord = (records > 12) ? (records - 12) : 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    rows = (records < 12) ? records : 12;
 | 
			
		||||
    for (row = 0; row < rows; row++) {
 | 
			
		||||
        rowId = gTopVisibleRecord + row;
 | 
			
		||||
        recordH = DmGetRecord(db, rowId);
 | 
			
		||||
        recordP = (MemPtr) MemHandleLock(recordH);
 | 
			
		||||
        TblSetItemPtr(table, row, 0, &recordP->barcode);
 | 
			
		||||
        if (StrCompareAscii(recordP->cases, "0") != 0) {
 | 
			
		||||
            TblSetItemPtr(table, row, 1, &recordP->cases);
 | 
			
		||||
        } else {
 | 
			
		||||
            TblSetItemPtr(table, row, 1, "");
 | 
			
		||||
        }
 | 
			
		||||
        if (StrCompareAscii(recordP->units, "0") != 0) {
 | 
			
		||||
            TblSetItemPtr(table, row, 2, &recordP->units);
 | 
			
		||||
        } else {
 | 
			
		||||
            TblSetItemPtr(table, row, 2, "");
 | 
			
		||||
        }
 | 
			
		||||
        recordIndex = gTopVisibleRecord + row;
 | 
			
		||||
        recordH = DmGetRecord(db, recordIndex);
 | 
			
		||||
        recordP = MemHandleLock(recordH);
 | 
			
		||||
 | 
			
		||||
        TblSetItemPtr(table, row, 0, recordP->barcode);
 | 
			
		||||
        TblSetItemInt(table, row, 1, recordP->cases);
 | 
			
		||||
        TblSetItemInt(table, row, 2, recordP->units);
 | 
			
		||||
 | 
			
		||||
        MemHandleUnlock(recordH);
 | 
			
		||||
        DmReleaseRecord(db, rowId, false);
 | 
			
		||||
        TblSetRowID(table, row, rowId);
 | 
			
		||||
        DmReleaseRecord(db, recordIndex, false);
 | 
			
		||||
 | 
			
		||||
        TblSetRowID(table, row, recordIndex);
 | 
			
		||||
        TblSetRowUsable(table, row, true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    DmCloseDatabase(db);
 | 
			
		||||
 | 
			
		||||
    for (row = 11; row >= rows; row--) {
 | 
			
		||||
        if (TblRowUsable(table, row)) {
 | 
			
		||||
            TblSetRowUsable(table, row, false);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    TblMarkTableInvalid(table);
 | 
			
		||||
 | 
			
		||||
    if (updateScroll) {
 | 
			
		||||
        form = FrmGetFormPtr(MainForm);
 | 
			
		||||
        scroll = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScroller));
 | 
			
		||||
        if (numRecords <= 12) {
 | 
			
		||||
        if (records <= 12) {
 | 
			
		||||
            SclSetScrollBar(scroll, 0, 0, 0, 0);
 | 
			
		||||
        } else {
 | 
			
		||||
            SclSetScrollBar(scroll, gTopVisibleRecord, 0, numRecords - 12, 11);
 | 
			
		||||
            SclSetScrollBar(scroll, gTopVisibleRecord, 0, records - 12, 11);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* static void MainFormLoadTable(TablePtr table, Boolean updateScroll) */
 | 
			
		||||
/* { */
 | 
			
		||||
/*     DmOpenRef           db; */
 | 
			
		||||
/*     UInt16              numRecords; */
 | 
			
		||||
/*     MemHandle           recordH; */
 | 
			
		||||
/*     /\* RatScanDbRecord*    recordP; *\/ */
 | 
			
		||||
/*     RattailScanRecord*  recordP; */
 | 
			
		||||
/*     UInt16              rows, row, rowId; */
 | 
			
		||||
/*     FormPtr             form; */
 | 
			
		||||
/*     ScrollBarPtr        scroll; */
 | 
			
		||||
    
 | 
			
		||||
/*     db = OpenScanDatabase(); */
 | 
			
		||||
/*     if (db == NULL) */
 | 
			
		||||
/*         return; */
 | 
			
		||||
 | 
			
		||||
/*     numRecords = DmNumRecords(db); */
 | 
			
		||||
/*     rows = (numRecords < 12) ? numRecords : 12; */
 | 
			
		||||
/*     if (gTopVisibleRecord < 0) */
 | 
			
		||||
/*         gTopVisibleRecord = (numRecords > 12) ? (numRecords - 12) : 0; */
 | 
			
		||||
 | 
			
		||||
/*     for (row = 0; row < rows; row++) { */
 | 
			
		||||
/*         rowId = gTopVisibleRecord + row; */
 | 
			
		||||
/*         recordH = DmGetRecord(db, rowId); */
 | 
			
		||||
/*         recordP = (MemPtr) MemHandleLock(recordH); */
 | 
			
		||||
/*         TblSetItemPtr(table, row, 0, &recordP->barcode); */
 | 
			
		||||
/*         /\* if (StrCompareAscii(recordP->cases, "0") != 0) { *\/ */
 | 
			
		||||
/*         /\*     TblSetItemPtr(table, row, 1, &recordP->cases); *\/ */
 | 
			
		||||
/*         /\* } else { *\/ */
 | 
			
		||||
/*         /\*     TblSetItemPtr(table, row, 1, ""); *\/ */
 | 
			
		||||
/*         /\* } *\/ */
 | 
			
		||||
/*         /\* if (StrCompareAscii(recordP->units, "0") != 0) { *\/ */
 | 
			
		||||
/*         /\*     TblSetItemPtr(table, row, 2, &recordP->units); *\/ */
 | 
			
		||||
/*         /\* } else { *\/ */
 | 
			
		||||
/*         /\*     TblSetItemPtr(table, row, 2, ""); *\/ */
 | 
			
		||||
/*         /\* } *\/ */
 | 
			
		||||
/*         MemHandleUnlock(recordH); */
 | 
			
		||||
/*         DmReleaseRecord(db, rowId, false); */
 | 
			
		||||
/*         TblSetRowID(table, row, rowId); */
 | 
			
		||||
/*         TblSetRowUsable(table, row, true); */
 | 
			
		||||
/*     } */
 | 
			
		||||
    
 | 
			
		||||
/*     DmCloseDatabase(db); */
 | 
			
		||||
/*     TblMarkTableInvalid(table); */
 | 
			
		||||
    
 | 
			
		||||
/*     if (updateScroll) { */
 | 
			
		||||
/*         form = FrmGetFormPtr(MainForm); */
 | 
			
		||||
/*         scroll = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScroller)); */
 | 
			
		||||
/*         if (numRecords <= 12) { */
 | 
			
		||||
/*             SclSetScrollBar(scroll, 0, 0, 0, 0); */
 | 
			
		||||
/*         } else { */
 | 
			
		||||
/*             SclSetScrollBar(scroll, gTopVisibleRecord, 0, numRecords - 12, 11); */
 | 
			
		||||
/*         } */
 | 
			
		||||
/*     } */
 | 
			
		||||
/* } */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/************************************************************
 | 
			
		||||
 *
 | 
			
		||||
 * FUNCTION:    BarcodeSelectItem
 | 
			
		||||
 *
 | 
			
		||||
 ************************************************************/
 | 
			
		||||
 | 
			
		||||
/* static void BarcodeSelectItem(Int16 row) */
 | 
			
		||||
/* { */
 | 
			
		||||
/*     FormPtr     form; */
 | 
			
		||||
/*     TablePtr    table; */
 | 
			
		||||
 | 
			
		||||
/*     form = FrmGetFormPtr(MainForm); */
 | 
			
		||||
/*     table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords)); */
 | 
			
		||||
 | 
			
		||||
/*     scanRecordsSelected[row] = true; */
 | 
			
		||||
/*     TblRedrawTable(table); */
 | 
			
		||||
/* } */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/************************************************************
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -902,7 +1203,7 @@ static void EnableScanner(Boolean enable)
 | 
			
		|||
        if (enable) {
 | 
			
		||||
            if (ScanGetScanEnabled() == 0) {
 | 
			
		||||
                if (ScanCmdScanEnable() != STATUS_OK) {
 | 
			
		||||
                    FrmAlert(AlertScannerEnableError);
 | 
			
		||||
                    FrmCustomAlert(AlertScannerError, "There was an error enabling the scanner.", "", "");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -989,6 +1290,7 @@ static void ProcessScan()
 | 
			
		|||
{
 | 
			
		||||
    FormPtr     form;
 | 
			
		||||
 | 
			
		||||
    ClearScanRecordSelection();
 | 
			
		||||
    form = FrmGetFormPtr(MainForm);
 | 
			
		||||
 | 
			
		||||
    if (IsChecked(form, MainFormStopOnCases)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1011,96 +1313,36 @@ static void ProcessScan()
 | 
			
		|||
 | 
			
		||||
static void StoreScanData()
 | 
			
		||||
{
 | 
			
		||||
    FormPtr     form;
 | 
			
		||||
    FieldPtr    barcode;
 | 
			
		||||
    ControlPtr  cases, units;
 | 
			
		||||
    /* Char*       quantity; */
 | 
			
		||||
    UInt32      size, offset;
 | 
			
		||||
    DmOpenRef   db;
 | 
			
		||||
    UInt16      recordIndex;
 | 
			
		||||
    MemHandle   recordH;
 | 
			
		||||
    MemPtr      recordP;
 | 
			
		||||
    TablePtr    table;
 | 
			
		||||
    UInt16      row;
 | 
			
		||||
    FormPtr             form;
 | 
			
		||||
    ControlPtr          ctrl;
 | 
			
		||||
    DmOpenRef           db;
 | 
			
		||||
    RattailScanRecord   record;
 | 
			
		||||
    UInt16              recordIndex;
 | 
			
		||||
    MemHandle           recordH;
 | 
			
		||||
    MemPtr              recordP;
 | 
			
		||||
    TablePtr            table;
 | 
			
		||||
    UInt16              row;
 | 
			
		||||
 | 
			
		||||
    // Get form and barcode field pointers.
 | 
			
		||||
    form = FrmGetFormPtr(MainForm);
 | 
			
		||||
    barcode = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormBarcode));
 | 
			
		||||
 | 
			
		||||
    // Set focus to barcode field if empty.
 | 
			
		||||
    if (FldGetTextLength(barcode) == 0) {
 | 
			
		||||
        FocusBarcode();
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    ctrl = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormBarcode));
 | 
			
		||||
    StrCopy(record.barcode, FldGetTextPtr((FieldPtr) ctrl));
 | 
			
		||||
 | 
			
		||||
    // Get case and unit field pointers.
 | 
			
		||||
    cases = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormCases));
 | 
			
		||||
    units = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormUnits));
 | 
			
		||||
    ctrl = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormCases));
 | 
			
		||||
    record.cases = StrAToI(CtlGetLabel(ctrl));
 | 
			
		||||
 | 
			
		||||
    ctrl = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormUnits));
 | 
			
		||||
    record.units = StrAToI(CtlGetLabel(ctrl));
 | 
			
		||||
 | 
			
		||||
    // Open the database and create a new record.
 | 
			
		||||
    db = OpenScanDatabase();
 | 
			
		||||
    if (db == NULL) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    recordIndex = dmMaxRecordIndex;
 | 
			
		||||
    recordH = DmNewRecord(db, &recordIndex, sizeof(RatScanDbRecord));
 | 
			
		||||
    if (recordH == 0) {
 | 
			
		||||
        DmCloseDatabase(db);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    // Write scan data to the record...
 | 
			
		||||
    recordH = DmNewRecord(db, &recordIndex, sizeof(RattailScanRecord));
 | 
			
		||||
    recordP = MemHandleLock(recordH);
 | 
			
		||||
    offset = 0;
 | 
			
		||||
 | 
			
		||||
    size = FldGetTextLength(barcode);
 | 
			
		||||
    DmWrite(recordP, offset, FldGetTextPtr(barcode), size);
 | 
			
		||||
    offset += size;
 | 
			
		||||
    
 | 
			
		||||
    size = 15 - size;
 | 
			
		||||
    DmSet(recordP, offset, size, 0);
 | 
			
		||||
    offset += size;
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
          size = FldGetTextLength(cases);
 | 
			
		||||
          DmWrite(recordP, offset, FldGetTextPtr(cases), size);
 | 
			
		||||
          offset += size;
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
    /* size = 2; */
 | 
			
		||||
    /* DmWrite(recordP, offset, "0", 2); */
 | 
			
		||||
    /* offset += size; */
 | 
			
		||||
    
 | 
			
		||||
    /* quantity = CtlGetLabel(cases); */
 | 
			
		||||
    /* size = StrLen(quantity); */
 | 
			
		||||
    /* DmWrite(recordP, offset, quantity, size); */
 | 
			
		||||
    /* offset += size; */
 | 
			
		||||
 | 
			
		||||
    size = StrLen(CtlGetLabel(cases));
 | 
			
		||||
    DmWrite(recordP, offset, CtlGetLabel(cases), size);
 | 
			
		||||
    offset += size;
 | 
			
		||||
 | 
			
		||||
    size = 4 - size;
 | 
			
		||||
    DmSet(recordP, offset, size, 0);
 | 
			
		||||
    offset += size;
 | 
			
		||||
    
 | 
			
		||||
    /* size = FldGetTextLength(units); */
 | 
			
		||||
    /* DmWrite(recordP, offset, FldGetTextPtr(units), size); */
 | 
			
		||||
    /* offset += size; */
 | 
			
		||||
 | 
			
		||||
    size = StrLen(CtlGetLabel(units));
 | 
			
		||||
    DmWrite(recordP, offset, CtlGetLabel(units), size);
 | 
			
		||||
    offset += size;
 | 
			
		||||
    
 | 
			
		||||
    size = 4 - size;
 | 
			
		||||
    DmSet(recordP, offset, size, 0);
 | 
			
		||||
    
 | 
			
		||||
    // ...then close the record and database.
 | 
			
		||||
    DmWrite(recordP, 0, &record, sizeof(RattailScanRecord));
 | 
			
		||||
    MemHandleUnlock(recordH);
 | 
			
		||||
    DmReleaseRecord(db, recordIndex, false);
 | 
			
		||||
    DmCloseDatabase(db);
 | 
			
		||||
 | 
			
		||||
    // Redraw the table.
 | 
			
		||||
    table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords));
 | 
			
		||||
    row = TblGetLastUsableRow(table);
 | 
			
		||||
    if (row == tblUnusableRow) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1114,6 +1356,115 @@ static void StoreScanData()
 | 
			
		|||
    FocusBarcode();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* static void StoreScanData() */
 | 
			
		||||
/* { */
 | 
			
		||||
/*     FormPtr     form; */
 | 
			
		||||
/*     FieldPtr    barcode; */
 | 
			
		||||
/*     /\* ControlPtr  cases, units; *\/ */
 | 
			
		||||
/*     /\* Char*       quantity; *\/ */
 | 
			
		||||
/*     /\* UInt8       quantity; *\/ */
 | 
			
		||||
/*     UInt32      size, offset; */
 | 
			
		||||
/*     DmOpenRef   db; */
 | 
			
		||||
/*     UInt16      recordIndex; */
 | 
			
		||||
/*     MemHandle   recordH; */
 | 
			
		||||
/*     MemPtr      recordP; */
 | 
			
		||||
/*     TablePtr    table; */
 | 
			
		||||
/*     UInt16      row; */
 | 
			
		||||
    
 | 
			
		||||
/*     // Get form and barcode field pointers. */
 | 
			
		||||
/*     form = FrmGetFormPtr(MainForm); */
 | 
			
		||||
/*     barcode = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormBarcode)); */
 | 
			
		||||
 | 
			
		||||
/*     // Set focus to barcode field if empty. */
 | 
			
		||||
/*     if (FldGetTextLength(barcode) == 0) { */
 | 
			
		||||
/*         FocusBarcode(); */
 | 
			
		||||
/*         return; */
 | 
			
		||||
/*     } */
 | 
			
		||||
    
 | 
			
		||||
/*     // Get case and unit field pointers. */
 | 
			
		||||
/*     /\* cases = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormCases)); *\/ */
 | 
			
		||||
/*     /\* units = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormUnits)); *\/ */
 | 
			
		||||
    
 | 
			
		||||
/*     // Open the database and create a new record. */
 | 
			
		||||
/*     db = OpenScanDatabase(); */
 | 
			
		||||
/*     if (db == NULL) { */
 | 
			
		||||
/*         return; */
 | 
			
		||||
/*     } */
 | 
			
		||||
/*     recordIndex = dmMaxRecordIndex; */
 | 
			
		||||
/*     /\* recordH = DmNewRecord(db, &recordIndex, sizeof(RatScanDbRecord)); *\/ */
 | 
			
		||||
/*     recordH = DmNewRecord(db, &recordIndex, sizeof(RattailScanRecord)); */
 | 
			
		||||
/*     if (recordH == 0) { */
 | 
			
		||||
/*         DmCloseDatabase(db); */
 | 
			
		||||
/*         return; */
 | 
			
		||||
/*     } */
 | 
			
		||||
    
 | 
			
		||||
/*     // Write scan data to the record... */
 | 
			
		||||
/*     recordP = MemHandleLock(recordH); */
 | 
			
		||||
/*     offset = 0; */
 | 
			
		||||
 | 
			
		||||
/*     size = FldGetTextLength(barcode); */
 | 
			
		||||
/*     DmWrite(recordP, offset, FldGetTextPtr(barcode), size); */
 | 
			
		||||
/*     offset += size; */
 | 
			
		||||
    
 | 
			
		||||
/*     size = 15 - size; */
 | 
			
		||||
/*     DmSet(recordP, offset, size, 0); */
 | 
			
		||||
/*     offset += size; */
 | 
			
		||||
 | 
			
		||||
/*     /\* */
 | 
			
		||||
/*           size = FldGetTextLength(cases); */
 | 
			
		||||
/*           DmWrite(recordP, offset, FldGetTextPtr(cases), size); */
 | 
			
		||||
/*           offset += size; */
 | 
			
		||||
/*     *\/ */
 | 
			
		||||
 | 
			
		||||
/*     /\* size = 2; *\/ */
 | 
			
		||||
/*     /\* DmWrite(recordP, offset, "0", 2); *\/ */
 | 
			
		||||
/*     /\* offset += size; *\/ */
 | 
			
		||||
    
 | 
			
		||||
/*     /\* quantity = CtlGetLabel(cases); *\/ */
 | 
			
		||||
/*     /\* size = StrLen(quantity); *\/ */
 | 
			
		||||
/*     /\* DmWrite(recordP, offset, quantity, size); *\/ */
 | 
			
		||||
/*     /\* offset += size; *\/ */
 | 
			
		||||
 | 
			
		||||
/*     /\* */
 | 
			
		||||
/*     size = StrLen(CtlGetLabel(cases)); */
 | 
			
		||||
/*     DmWrite(recordP, offset, CtlGetLabel(cases), size); */
 | 
			
		||||
/*     offset += size; */
 | 
			
		||||
 | 
			
		||||
/*     size = 4 - size; */
 | 
			
		||||
/*     DmSet(recordP, offset, size, 0); */
 | 
			
		||||
/*     offset += size; */
 | 
			
		||||
/*     *\/ */
 | 
			
		||||
    
 | 
			
		||||
/*     /\* size = FldGetTextLength(units); *\/ */
 | 
			
		||||
/*     /\* DmWrite(recordP, offset, FldGetTextPtr(units), size); *\/ */
 | 
			
		||||
/*     /\* offset += size; *\/ */
 | 
			
		||||
 | 
			
		||||
/*     size = StrLen(CtlGetLabel(units)); */
 | 
			
		||||
/*     DmWrite(recordP, offset, CtlGetLabel(units), size); */
 | 
			
		||||
/*     offset += size; */
 | 
			
		||||
    
 | 
			
		||||
/*     size = 4 - size; */
 | 
			
		||||
/*     DmSet(recordP, offset, size, 0); */
 | 
			
		||||
    
 | 
			
		||||
/*     // ...then close the record and database. */
 | 
			
		||||
/*     MemHandleUnlock(recordH); */
 | 
			
		||||
/*     DmReleaseRecord(db, recordIndex, false); */
 | 
			
		||||
/*     DmCloseDatabase(db); */
 | 
			
		||||
    
 | 
			
		||||
/*     // Redraw the table. */
 | 
			
		||||
/*     table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords)); */
 | 
			
		||||
/*     row = TblGetLastUsableRow(table); */
 | 
			
		||||
/*     if (row == tblUnusableRow) { */
 | 
			
		||||
/*         gTopVisibleRecord = 0; */
 | 
			
		||||
/*     } else if (row == 11) { */
 | 
			
		||||
/*         gTopVisibleRecord = TblGetRowID(table, 1); */
 | 
			
		||||
/*     } */
 | 
			
		||||
/*     MainFormLoadTable(table, true); */
 | 
			
		||||
/*     TblRedrawTable(table); */
 | 
			
		||||
 | 
			
		||||
/*     FocusBarcode(); */
 | 
			
		||||
/* } */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef SCANLIB_JANAM
 | 
			
		||||
/************************************************************
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,9 +16,9 @@
 | 
			
		|||
#define MainFormUnits							1001
 | 
			
		||||
 | 
			
		||||
#define AlertTest								1000
 | 
			
		||||
#define AlertScannerOpenError                   1300
 | 
			
		||||
#define AlertScannerEnableError                 1200
 | 
			
		||||
#define AlertScannerCloseError                  1100
 | 
			
		||||
#define AlertInformation                        1200
 | 
			
		||||
#define AlertConfirmation                       1100
 | 
			
		||||
#define AlertScannerError                       1400
 | 
			
		||||
 | 
			
		||||
//	Resource: tFRM 1100
 | 
			
		||||
#define AboutForm                                 1100	//(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -50,12 +50,11 @@
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
//	Resource: MBAR 1000
 | 
			
		||||
#define MainFormMenuBar                           1000
 | 
			
		||||
 | 
			
		||||
#define MainFormMenuBar                         1000
 | 
			
		||||
 | 
			
		||||
//	Resource: MENU 1000
 | 
			
		||||
#define MainOptionsMenu                           1000
 | 
			
		||||
#define MainOptionsAboutStarterApp                1000
 | 
			
		||||
#define MainEditDeleteRecords                   1001
 | 
			
		||||
#define MainOptionsAboutRattail                 1000
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//	Resource: PICT 1001
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue