Actually, this doesn't work. The itemNumber variable refers to the place in the list that the record is to be displayed and it seems to be generated and incremented by the OS as evidenced by the fact that stepping through debugging mode winds up in assembler code between iterations of the draw function. The process of selecting which records to display is external to the itemNumber. That will generate and increment whether the list is drwn with a visible record or not.

Matt Graham wrote:
What you have to do is find out how many of your records have "Y", say N, then set the number of list choices to N, then in your draw function, itemNumber refers to a record in the set of those with "Y".

The trick is doing this efficiently.



Steven M. Jerrett wrote:


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.


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????






-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to