My question involves selectively loading a list using a LstSetDrawFunction function without winding up with blank "slots" in the list. The data involved contains a "Dspfg" field that contains "Y" if it is to be displayed in the initial list or "N" if not.
When my program initiates its form open:
static void MainListFormOpen(FormPtr frmP)
{
ListPtr list = (ListPtr) GetObjectFromActiveForm(MainParentList);
InitNumberDwells(); <--------Computes/sets LstSetListChoices
LstSetDrawFunction(list, DrawOneDwellInList);
LstSetSelection(list, noListSelection);
}...... and here's the draw function:
static void DrawOneDwellInList(Int16 itemNumber, RectanglePtr bounds, Char **text)
{
#pragma unused(text)
MemHandle h;
UInt16 index = 0;
Dwells Dw;
Int16 res = 0;
char dispRec[1];
char Disp[1];
char dispLoc[128];
char dispUnit[128];
StrCopy(Disp, "Y");
DmSeekRecordInCategory(gDwDB, &index, (UInt16) itemNumber, dmSeekForward,
dmAllCategories);
h = DmQueryRecord(gDwDB, index);
if (h)
{
UnpackDwells(&Dw, (PackedDwells *) MemHandleLock(h));
StrCopy(dispRec, Dw.Dspfg);
res = StrCaselessCompare(dispRec, Disp);
if (res == 0)
{
StrCopy(dispLoc, Dw.Loc);
StrCopy(dispUnit, Dw.Unit);
DrawCharsToFitWidth2(dispLoc, dispUnit, bounds);
}
MemHandleUnlock(h);
}
}When this executes, the list is populated thusly:
3703 Oakland Gravel Rd Bldg Main A 3703 Oakland Gravel Rd Bldg Main B 3703 Oakland Gravel Rd Bldg Main C
3800 Cooper Drive East Bldg 2
with blank spots where the records with "N" in Dspfg would normally be displayed. Ideally, the display should be:
3703 Oakland Gravel Rd Bldg Main A 3703 Oakland Gravel Rd Bldg Main B 3703 Oakland Gravel Rd Bldg Main C 3800 Cooper Drive East Bldg 2
Using categories is not an option in this case for a variety of reasons. It seems as if the choices are either what is being displayed currently (with the blanks) or displaying all the records. Does anyone have any suggestions????
Steve Jerrett Systems Analyst City of Columbia, MO
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
