-----Original Message-----
From: Brian Smith [mailto:[EMAIL PROTECTED]]
Sent: Friday, 4 January 2002 2:16 PM
To: Palm Developer Forum
Subject: RE: Efficiency question


> The reason for that is that when I delete one line
> that I no longer need, the ones after it get renumbered. 

If I understand you correctly, you have one record per line.
Probably not quite a compact way to store the records (remember that each
record needs record info to be stored as well), but easy for implementing
what you are after.

Each record (i.e. line) has a DB index, that is handled automatically by DB
manager.
Each line deletion is effectively DmRemoveRecord, each line insertion is
DmNewRecord with corresponding index. Say, while inserting a line with index
I, all records with index >=I have their index incremented automatically
(page 569, PalmOS reference sdk 4.0).

Now, for each window you keep the index for the top record (top index). In
this case each deletion / insertion (as far as I understand your model)
affects the content of following windows, while the top index is always the
same and depends on window line size! What it effectively means, that you
just need to redraw a window before it is shown, but you have to do it
anyway :-). Well, you can keep 'modified' flag for each window to minimize
the need to redraw, but this increases the code and the 'entropy'.

Michael



-- 
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