Well, here I am with some more list problems/questions.
I've gone through and read the 30k messages of this archive paying
special attention to those on lists, but I daresay I am more confused
than before :-(
Here's the scenario, I have a database on the palm that contains some
information like so:
typedef struct {
FlpCompDouble MyFloat1;
FlpCompDouble MyFloat2;
Char* name;
} MyData;
There are currently 28 entries and I have a list that I created manually
with each of the name entries. Currently I get access to MyFloat1 and
MyFloat2 by using the indexes from the static list contents to database
records. I would prefer to also get the name from the database and thus
create the list (that way I only have to update the pdb when data
changes...)
So this is what I'm trying to initialize the list without success. I'm
obviously having memory aloocating problem (among other things?) but
because I'm confused, I don't know where.
MyData myEntry;
ListPtr listP;
ControlPtr ctrlP;
MemHandle h;
Char* myName[28];
for (int i = 0; i < 28; i++)
{
h = DmQueryRecord(MyDB, i);
myEntry = MemHandleLock(h);
myName[i] = myEntry->name;
MemHandleUnlock(h);
}
listP = FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, myList));
LstSetListChoices(listP, myName, 28);
ctrlP = FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, myPop));
LstSetSelection(listP, prefs.mySelection);
LstSetTopItem(listP, prefs.mySelection);
CtlSetLabel(ctrlP, LstGetSelectionText(listP, prefs.mySelection));
Is there anything else that you would need to be able to assist me.
Some wise words would do wonders to help clear up my confusion in this
matter, I'm sure there is much that I'm doing backwards, but with your
help I'll learn to do it the right way...
Also, what's the best way to automatically assign the number of elements
to my Char* name[28]?
Thanks,
Andrew
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/