I was working on an idea similar to that.
I have the records being sorted, and in the sort function, it will
accumulate the number of "matching" records. I was hoping that I could just
only use DmQueryNextInCategory() for X amount of times so it only displayed
the matched top records. However, that only produces jaded results
Here is my Table Loading Function if anyone wants to see it.
static void DisSelectViewLoadTable(FormPtr frm)
{
Word row;
Word recordNum;
Word lineHeight;
Word dataHeight;
Word tableHeight;
Word lastRecordNum;
Word numRows;
ULong uniqueID;
FontID currFont;
TablePtr table;
VoidHand record;
RectangleType r;
table = GetObjectPtr(DisSelectDistanceTableTable);
TblGetBounds(table, &r);
tableHeight = r.extent.y;
currFont = FntSetFont(stdFont);
lineHeight = FntLineHeight();
FntSetFont(currFont);
dataHeight = 0;
recordNum = tblDistTopRecord;
// For each row in the table, store the record in the table item
// that will display the record.
numRows = TblGetNumberOfRows(table);
for(row = 0; row < numRows; row++)
{
/********************************************************
* Here is where I tried to limit the querying
*
if(row < NumOfDist)
{
// Get the next record in the current category.
record = DmQueryNextInCategory(gDistDB, &recordNum,
dmAllCategories);
}
else
record = NULL;
*
********************************************************/
// If the record was found, store the record number in the table
item,
// otherwise set the table row unusable.
if(record && (tableHeight >= dataHeight + lineHeight))
{
TblSetRowID(table, row, recordNum);
// Set Jurisdiction Field
TblSetItemStyle(table, row, 0, textTableItem);
TblSetItemFont(table, row, 0, stdFont);
// Set Odometer Field
TblSetItemStyle(table, row, 1, textTableItem);
TblSetItemFont(table, row, 1, stdFont);
TblSetRowHeight(table, row, lineHeight);
DmRecordInfo(gDistDB, recordNum, NULL, &uniqueID, NULL);
if((TblGetRowData(table, row) != uniqueID) ||
(!TblRowUsable(table, row)))
{
TblSetRowUsable(table, row, true);
// Store the unique id of the record in the row.
TblSetRowData(table, row, uniqueID);
// Mark the row invalid so that it will draw when we
call the
// draw routine.
TblMarkRowInvalid(table, row);
}
lastRecordNum = recordNum;
if(row + 1 < numRows)
recordNum++;
dataHeight += lineHeight;
}
else
TblSetRowUsable(table, row, false);
}
// Update the scroll arrows.
DisSelectViewUpdateScrollers(frm, lastRecordNum);
}
Timothy D. Astle
People on Jolt cola write the funniest things.
A-10 Obedience Guide,
Kitty Hawk Studios
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/