on 8/31/00 1:49 PM, Dan Samber at [EMAIL PROTECTED] wrote:

> As part of my voyage away from the newbie kingdom, I have made my
> first encounter with the land of databases.
> 
> The Memopad tutorial slowly evolves until it is (by I think Memopad7)
> editing the database "in-place". While I understand the benefits of such
> a maneuver, it SEEMS to me that this arrangement would get increasingly
> difficult for databases whose records consist of more than the one field
> as demonstrated in Memopad.

I find editing in place useful for Notes forms, where the potential amount
of data might prove problematic for the dynamic heap on some
devices/configurations (by default, edit fields use the dynamic heap to
manage their contents during editing).

However, if a form has several edit fields and they map to database fields
within a record, you can only link one edit field with one DB field at a
time. You use FldSetText() to create the link (the Field manager and the
Data manager work together to resize the DB record as the user edits). The
extra work comes when the user tabs or taps into another edit field.

For these cases, before you can use FldSetText to link the new edit field,
1. compact the heap space used by the edit field so that your DB record is
as small as possible (FldCompactText(pFld))
2. disassociate the edit field's text handle from the database
(FldSetTextHandle(pFld, NULL)).
And you must do this for all the ways the user can switch to another field
(tap into field, tab from a keyboard, write Graffiti next- or previousField
chars). 

Not difficult to do, and probably the right approach for some apps, but for
most of mine, I just set all the fields' contents with copies of the data
when the form receives a frmOpenEvent (note: you'd have to do this anyway),
then when I'm ready to copy data back to the database, I check for edit
fields that have changed and copy their data back to the record, resizing as
necessary.

Summary: 
Edit in place: the OS takes care of resizing the database record; you take
care of making it happen at the appropriate times.
Otherwise: you must resize the database record before copying back the
edited data; the system handles editing and user navigation.

JB

----------------------------------------------
JB Parrett                 [EMAIL PROTECTED]
Palm, Inc.         

We grow a lot faster than trees,
so we miss a lot of stuff. - B. Andreas


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

Reply via email to