In my program I use a process for finding items that mimics the Palm global
Find feature.  The user enters some search characters into a field on my
Main form. Then
taps the Find button on the Main form. The Find form then appears and it
lists all
the matches that were found. The user then taps one of the hits and the Find
form goes away and
the Main form reappears with the item the user selected.

Everything works fine except under OS 3.5, 3.5.1 and 3.5.2.  Under those
OS's when I tap an item in the list of hits the item never gets highlighted.
I immediately get a bus error on POSE (3.2) and a Fatal Error on an actual
device (m100).

(Code snippets below)

Thanks in advance...

Mitch Fawcett
Tapn'see Software
Home of SuperList2 and SuperList3
http://www.tapnsee.com

Here is a code snippet of how I populate the list on the Find form:
 while (true)
 {
  vhRec = DmQueryRecord(dbItems, index);
    if (! vhRec)
      break; // end of database.
  pPackedItem = MemHandleLock (vhRec);
    UnpackItem (&item, pPackedItem);

  match =  StrNCaselessCompare (item.cpItemName, strToFind,
StrLen(strToFind));
  if (match == 0)
  {
   gRecNum[i] = index; // record number to find item if user taps on it.
   gListID[i] = item.bListID; // List if of item.
   // Get name of master list the item was found in.
   cpListName = GetListNameFromID (dbLists, item.bListID);
   vh[i] = MemHandleNew(StrLen(cpListName) + StrLen(item.cpItemName) + 3);
   // Add the name to the array of charptrs.
   cpItems[i] = MemHandleLock(vh[i]);
   *cpItems[i] = 0; // Initialize a zero length string.
   cpItems[i] = StrCat(cpItems[i], cpListName);
   cpItems[i] = StrCat(cpItems[i], " ");
   cpItems[i] = StrCat(cpItems[i], item.cpItemName);
   i++; // Increment count of matching records.
  }
  MemHandleUnlock(vhRec);
  index++; // increment record pointer.
  if (i == 10)
   break;
 }
 LstSetListChoices (plst, cpItems, i);  // I'm not using a callback to draw.
Just supplying the array of strings.
the list.
    LstDrawList (plst);
    gStart = index;

Here is a code snippet of what is supposed to happen when the user taps an
item in the list of hits. It is from the event handler of the Find form.
  case lstSelectEvent:
  {
   // User selected an item from the list of items found to match the search
string.
   // Use the same code used by the Palm global find to open the main form
with the selected
   // item highlighted.
   // Get the row number of the selected item.
   plst = event->data.lstSelect.pList;
   row = LstGetSelection (plst);
   recNum = gRecNum[row];

   // Show the main form so item can be navigated to.
   FrmGotoForm (MainForm);

   // Construct and send an event to select the item.
   MemSet (&goevent, 0, sizeof (EventType));
   goevent.eType = frmGotoEvent;
   goevent.data.frmGoto.formID = MainForm;
   goevent.data.frmGoto.recordNum = recNum;
   goevent.data.frmGoto.matchPos = 0;
   goevent.data.frmGoto.matchLen = 2;
   goevent.data.frmGoto.matchFieldNum = 3 ;
   goevent.data.frmGoto.matchCustom = 0;
   EvtAddEventToQueue (&goevent);

   handled = true;
   return (handled);
  }




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

Reply via email to