add support for deleting all records in batch
This commit is contained in:
parent
8822d6cd45
commit
8f10956bae
|
@ -624,7 +624,13 @@
|
||||||
<MENU_ITEMS>
|
<MENU_ITEMS>
|
||||||
<MENU_ITEM>
|
<MENU_ITEM>
|
||||||
<ID> 1001 </ID>
|
<ID> 1001 </ID>
|
||||||
<TITLE> "Delete Record(s)" </TITLE>
|
<TITLE> "Delete Selected" </TITLE>
|
||||||
|
<COMMAND> "" </COMMAND>
|
||||||
|
<HIDDEN> FALSE </HIDDEN>
|
||||||
|
</MENU_ITEM>
|
||||||
|
<MENU_ITEM>
|
||||||
|
<ID> 1002 </ID>
|
||||||
|
<TITLE> "Delete All" </TITLE>
|
||||||
<COMMAND> "" </COMMAND>
|
<COMMAND> "" </COMMAND>
|
||||||
<HIDDEN> FALSE </HIDDEN>
|
<HIDDEN> FALSE </HIDDEN>
|
||||||
</MENU_ITEM>
|
</MENU_ITEM>
|
||||||
|
|
|
@ -721,14 +721,15 @@ static Boolean MainFormDoCommand(UInt16 command)
|
||||||
FormPtr form;
|
FormPtr form;
|
||||||
TablePtr table;
|
TablePtr table;
|
||||||
DmOpenRef db;
|
DmOpenRef db;
|
||||||
UInt16 row, rowIndex, offset;
|
UInt16 row, offset, records;
|
||||||
|
Int16 rowIndex;
|
||||||
Boolean selected;
|
Boolean selected;
|
||||||
|
|
||||||
handled = false;
|
handled = false;
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
|
|
||||||
case MainEditDeleteRecords:
|
case MainEditDeleteSelected:
|
||||||
selected = false;
|
selected = false;
|
||||||
for (row = 0; row < 12; row++) {
|
for (row = 0; row < 12; row++) {
|
||||||
if (scanRecordsSelected[row]) {
|
if (scanRecordsSelected[row]) {
|
||||||
|
@ -760,6 +761,30 @@ static Boolean MainFormDoCommand(UInt16 command)
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MainEditDeleteAll:
|
||||||
|
db = OpenScanDatabase();
|
||||||
|
records = DmNumRecords(db);
|
||||||
|
DmCloseDatabase(db);
|
||||||
|
if (records) {
|
||||||
|
if (FrmCustomAlert(AlertConfirmation,
|
||||||
|
"This will delete ALL records in the batch.\n\nDo you really wish to do this?", "", "") == 0) {
|
||||||
|
db = OpenScanDatabase();
|
||||||
|
for (rowIndex = records - 1; rowIndex >= 0; rowIndex--) {
|
||||||
|
DmRemoveRecord(db, rowIndex);
|
||||||
|
}
|
||||||
|
DmCloseDatabase(db);
|
||||||
|
form = FrmGetFormPtr(MainForm);
|
||||||
|
table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormScanRecords));
|
||||||
|
MainFormLoadTable(table, true);
|
||||||
|
ClearScanRecordSelection();
|
||||||
|
TblRedrawTable(table);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
FrmCustomAlert(AlertInformation, "The batch is already empty.", "", "");
|
||||||
|
}
|
||||||
|
handled = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case MainOptionsAboutRattail:
|
case MainOptionsAboutRattail:
|
||||||
form = FrmInitForm(AboutForm);
|
form = FrmInitForm(AboutForm);
|
||||||
FrmDoDialog(form);
|
FrmDoDialog(form);
|
||||||
|
|
|
@ -53,7 +53,8 @@
|
||||||
#define MainFormMenuBar 1000
|
#define MainFormMenuBar 1000
|
||||||
|
|
||||||
// Resource: MENU 1000
|
// Resource: MENU 1000
|
||||||
#define MainEditDeleteRecords 1001
|
#define MainEditDeleteSelected 1001
|
||||||
|
#define MainEditDeleteAll 1002
|
||||||
#define MainOptionsAboutRattail 1000
|
#define MainOptionsAboutRattail 1000
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue