OK. I can't do it. I don't know what's wrong!
I've drawn a list. If a record exists at the index referred to by
LstGetSelection(listp), then I need to do a string copy as
demonstrated:(recordname is a global string) Do I need to create a handle to
it? If so, how do I get a handle to an existing variable, rather than
creating a new chunk? MemPtrRecoverHandle() seems to complain. Should I
create a global handle, as a StrCopy is performed on recordname[] in several
other functions. But it seems to work in those function, just passing
&recordname[0])
At the moment, the application fails and crashes on trying to StrCopy() in
the loop given below.
...<snip>
{
listptr = FrmGetObjectPtr(FrmGetActiveForm(),
(FrmGetObjectIndex(FrmGetActiveForm(),
Palmoscope_recordlistRecord_list_lstList)));
listchoice = LstGetSelection(listptr); //get the index of the selected
item in the list
if(LstGetSelectionText(listptr, listchoice))
{
if(DmQueryRecord(PalmoscopeDB, listchoice))
{
StrCopy(&recordname[0], LstGetSelectionText(listptr,
listchoice));
FrmReturnToForm(0);
FrmSetActiveForm(CurrentView);
filenameindex = FrmGetObjectIndex(FrmGetActiveForm(),
Palmoscope_mainFilename_fldField);
FldSetTextPtr(FrmGetObjectPtr(FrmGetActiveForm(), filenameindex),
&recordname[0]);
//redraw form so that field will be updated. Or could use
FldDrawField()
FrmDrawForm(CurrentView);
SetCurrentMenu(MainFormMenuBar);//load new menu to go with new form
handled = true;
}
}
}
...<snip>
I've spent hours and got nowhere. I'm sure I'm missing something trivial.
Any help would be great.
Cheers,
Mike.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html