http://www.newton-inc.com/dev/techinfo/qa/qa.htm
protoTextList
after it is displayed. I add an item and scroll to highlight that item. However, the state of the scroll arrows does not correctly get updated. Sometimes it will indicate that there are more items to scroll when it is really at the end of the list.protoTextList
to reset the scroll distance when you update the listItems array. The workaround is to always scroll the list to the top before calling SetupList
when you add items. Then you can scroll the list to where you want it. Note that this workaround is safe to use in Newton 2.1 OS as well. In other words, if you are adding items to a protoTextList
, use this workaround unless your application is Newton 2.1 OS-specific. This method will add a single item to the protoTextList
, set the highlighted item to the new item and scroll if required. It will also make sure the item is unique. AddListItem := func(newItem)
begin
// Insert the item if not already in Array
local index := BInsert(listItems, item, '|str<|, nil, true);
// item must be in the array and index will point to the item.
if NOT index then
begin
:Notify(kNotifyAlert, kAppName, "Duplicate entry.");
return nil;
end;
// workaround a bug in 2.0 that causes the
// scroll arrows to get out of sync
// do this by scrolling to the top
:DoScrollScript(-viewOriginY) ;
self:SetUpList();
// Setting the selection slot will highlight the item
selection := index;
// scroll to show the new item
if index >= viewLines then
:DoScrollScript((index - viewLines + 1) * lineHeight) ;
self:RedoChildren();
return true;
end ;