You didn't like my code snippet, right? Never mind, but how shall this work?
ghStringArray = SysFormPointerArrayToStrings(p, 1);
strArray = (Char**) MemHandleLock(ghStringArray);
MemHandleUnlock(h); // unlock each record
Regards
Henk
druid wrote:
Ok on my own I got this to work almost
#include <PalmOS.h>
#include "SearchDB.h"
#include "SearchDB_res.h"
#define DB_NAME "testDB"
#define DB_CARDNO 0
#define DB_CREATOR 'DPDc'
#define DB_TYPE 'DATA'
MemHandle h;
MemHandle ghStringArray = 0;
DmOpenRef dbPtr = NULL;
UInt16 nRecordIndex = 0;
UInt16 index = 0;
FormPtr pForm;
ListType *lsp1;
static Boolean frmMain_srhButton_OnSelect(EventPtr event)
{
Char *p;
Char **strArray = {""}; //empty array
Char* strLines = NULL;
Err err = Open(); // routine to open database
pForm = FrmGetActiveForm(); // get active form
lsp1 = FrmGetObjectPtr(pForm, FrmGetObjectIndex(pForm, frmList1)); //
get id of list control
nRecordIndex = DmNumRecords(dbPtr); // number of records
for(index =0; index < nRecordIndex; index++) // lets index through
database
{
h =DmQueryRecord(dbPtr, index); // lets query each record
p = (Char *) MemHandleLock(h); // lets lock each record
ghStringArray = SysFormPointerArrayToStrings(p, 1);
strArray = (Char**) MemHandleLock(ghStringArray);
MemHandleUnlock(h); // unlock each record
}
LstSetListChoices(lsp1,strArray,index); // clear list
LstDrawList( lsp1 );
err = CloseDB();
return true;
}
...
--
-------------------------------------------------------------------------
Henk Jonas [EMAIL PROTECTED]
Palm OS ® certified developer
Please contact me, if you need an off-site contract worker.
-------------------------------------------------------------------------
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/