On Fri, 2003-01-17 at 13:33, David McNab wrote: > I'm coding a function which needs to return the text contents of a > field, given only the field ID. > > The FldGetTextPtr() function reqires the field ptr as an argument, which > makes life hard.
You're likely looking for 'FrmGetObjectPtr'. In the event handling function for forms, you might see code something like this (obviously, we'd check for all valid parameters, of course...:^): form = FrmGetActiveForm(); fldPtr = FrmGetObjectPtr(form,FrmGetObjectIndex(form,frmID)); memH = FldGetTextHandle(fldPtr); fldTextP = MemHandleLock(memH); StrCopy(destBuffer,fldTextP); MemHandleUnlock(memH); Note that this is *only* for reading a field. If you tried to change that text once you've got a pointer, you could screw up the field, and head down the path of true confusion. In that case, you should remove the Text handle from the field, edit the text in the handle, then set the text handle for the field again. Refer to FldSetTextHandle in the docs for a full discussion. -Ken > > (For reasons which take too long to explain, there's no way of passing > the function the field's pointer). > > While there are Form functions to convert between Form ID and Form > pointer, there's nothing equivalent for fields. > > How can I, given just the field ID, find out the field's pointer, then > get the field's text value? > > (If necessary, I can also pass the function the form pointer or ID for > the form that contains the field). > > Thanks for help > > David > > > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please see >http://www.palmos.com/dev/support/forums/ > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
