53 lines
1.1 KiB
C++
53 lines
1.1 KiB
C++
|
#include "sc2201.h"
|
||
|
|
||
|
///////////////////////////////////////////////////////////////////////////////
|
||
|
// TCursor_sheet_RecNo //
|
||
|
///////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
TCursor_sheet_RecNo::TCursor_sheet_RecNo(TCursor * cursor, const char* fields,
|
||
|
const char * title, const char * head, byte buttons)
|
||
|
: TCursor_sheet(cursor, fields, title, head, buttons)
|
||
|
{
|
||
|
_recnos.reset();
|
||
|
}
|
||
|
|
||
|
bool TCursor_sheet_RecNo::on_key(KEY k)
|
||
|
{
|
||
|
switch(k)
|
||
|
{
|
||
|
case K_SPACE:
|
||
|
{
|
||
|
*_cursor = selected(); // Posiziona il cursore
|
||
|
rec_check(_cursor->file().recno(), !checked(selected()));
|
||
|
break;
|
||
|
}
|
||
|
case K_F2:
|
||
|
rec_uncheck(-1);
|
||
|
break;
|
||
|
case K_F3:
|
||
|
rec_check(-1);
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
return TCursor_sheet::on_key(k);
|
||
|
}
|
||
|
|
||
|
void TCursor_sheet_RecNo::rec_check(long n, bool on)
|
||
|
{
|
||
|
if (n < 0)
|
||
|
{
|
||
|
if (on)
|
||
|
{
|
||
|
_recnos.set(items()-1); // Force the size of Bit_array
|
||
|
_recnos.set();
|
||
|
}
|
||
|
else
|
||
|
_recnos.reset();
|
||
|
}
|
||
|
else
|
||
|
_recnos.set(n, on);
|
||
|
}
|
||
|
|
||
|
|