druid wrote:

To fill a list with the first field of each record


Err err = Open(); // routine to open database
        Char **strArray = {""}; //empty array
What's this?

Char **strArray = NULL;
strArray = MemPtrNew(recordcount * sizeof(Char *));
for i=0; i<recordcount; i++
{
  stringlength = ...
  strArray[i] = MemPtrNew(stringlength);
  StrCopy(strArray[i], ...
}

etc.


later on:
for i=0; i<recordcount; i++
  MemPtrFree(strArray[i]);
MemPtrFree(strArray);


I haven't put any checks in this example. You should do it for each and every MemPtrNew().

Regards
Henk


        nRecordIndex = DmNumRecords(dbPtr); // number of records
        for(index =0; index < nRecordIndex; index++) // lets index through 
database
         {
          h =DmQueryRecord(dbPtr, index); // lets query each record
          RecordPtr = MemHandleLock(h);  // lets lock each record
//need to extract first field of each record here and insert it into //a form list named frmList1
          // I think I need to fill an array then asign the array to the list
          //using LstSetListChoices
MemHandleUnlock(h); // unlock each record }
        pForm = FrmGetActiveForm(); // get active form
        lsp1 = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, frmList1)); // 
get id of list control
        LstSetListChoices(lsp1,strArray,0); // clear list
        
        
        // fill list with array
        //Err err = CloseDB();
        return true;



--
-------------------------------------------------------------------------
  Henk Jonas                                            [EMAIL PROTECTED]
  Palm OS ® certified developer

  Please contact me, if you need an off-side contract worker.
-------------------------------------------------------------------------

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

Reply via email to