Greetings everyone.
I am wondering if anyone can enlighten me on what I'm doing wrong.
I am trying to support categories for the first time. When
displaying only records in the current category, it seems to work fine.
HOWEVER, when I try and go from the last record back to the first
or vice versa it doesn't seem to work properly.
I tried to adapt code from how categories are handled in tables.
I would GREATLY appreciate any help.
Here's what I came up with:
static Boolean SeekRecord( unsigned short * indexP, short offset, short
direction ) {
DmSeekRecordInCategory( gDB, indexP, offset, direction, CurrentCategory);
if ( DmGetLastErr() )
return ( false );
return ( true );
}
// initialization
gCurrRec = gTopVisibleRecord;
SeekRecord( &gCurrRec, 0, dmSeekForward );
// loop
case ShowUpButton:
newTopVisibleRecord = gTopVisibleRecord;
// Scroll up by the requested number of
lines
if ( !SeekRecord( &newTopVisibleRecord,
true, dmSeekBackward ) )
{
// Goto last record
newTopVisibleRecord =
dmMaxRecordIndex;
SeekRecord(
&newTopVisibleRecord, 1, dmSeekBackward );
}
gCurrRec = newTopVisibleRecord;
gTopVisibleRecord = newTopVisibleRecord;
GrabRecordToEdit();
FrmGotoForm (ShowForm);
handled = true;
break;
case ShowDownButton:
newTopVisibleRecord = gTopVisibleRecord;
// Scroll down by the requested number
of lines
if( !SeekRecord( &newTopVisibleRecord,
true, dmSeekForward ) )
{
// Goto first record
newTopVisibleRecord = 0;
SeekRecord(
&newTopVisibleRecord, 1, dmSeekBackward );
}
gCurrRec = newTopVisibleRecord;
gTopVisibleRecord = newTopVisibleRecord;
GrabRecordToEdit();
FrmGotoForm (ShowForm);
handled = true;
break;
Stephen Bentley
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/