- the list has 12 visible items, and 2979 items total
- using the up down arrows (not the field, see below) all items are displayed
But when, at the initialisation, using
LstSetSelection (lst, 2967);
LstSetTopItem (lst, 2967);the list display is blank.
Actually from exactly 2979 items, the last 12 items are not displayed.
I tried with more items, it is even strangier: - items from 2967 to (about) 3100 are not displayed - then there are ok - then from exactly 14883 they are not displayed, till the end!
Both CW and prc-tools give the same result.
Algo ====
- a field allows the user to enter characters to find the beginning of strings to be displayed
- each time a char is entered, the prog look for the right item to be displayed, and display the 11 ones below it.
A bit like the Address Lookup.
- I use LstSetDrawFunction
Any ideas will be greatly apreciated. Thanks.
Program (extract) =======
FormInit ()
{ ...
LstSetDrawFunction (lst, DrawListItem);
LstSetListChoices(lst, NULL, MAX_ENTRIES);
LstSetSelection (lst, 0);
LstSetTopItem (lst, 0);
...
FrmDrawForm(frm);
...
}DrawListItem (item)
{ ...
str = find_the_item (item);
WinDrawChars (str, StrLen(str), ...x, ...y);
} FormHandleEvent (event)
{ ...
switch (event->eType)
{
case frmOpenEvent:
FormInit ();
handled = true;
break;// The problem may be in the Field event mgmt !
case keyDownEvent:
case fldEnterEvent:
frm = FrmGetActiveForm();
fld = FrmGetObjectPtr (frm, ... myfield); if (FldHandleEvent (fld, event))
{
lst = FrmGetObjectPtr (frm, mylist);
txt = FldGetTextPtr (fld);
n = get_item_to_be_displayed (txt); LstSetTopItem (lst, n);
LstSetSelection (lst, n);// Request display of list
LstDrawList (lst);
}
handled = true;
break;
}
return(handled);
}
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
