On Jul 31, 2008, at 8:25 AM, jda wrote:
I have a series of ancillary text files whose names my app displays
to the user in a listbox. These files contain connection information
that my app uses to access different Internet sites. There is one
function (it doesn't matter what) that can be enabled or disabled,
and I want the user to see that in the listbox display.
My solution has been to add a resource of my own making to each file
that contains text, either "true" or "false". If "true", the name of
the file is displayed in italics in the listbox. If "false" it is
displayed in plain text. So all I need do is check the resource of
each file (there may be many hundreds of them) and then set the text
style of the listbox cell accordingly.
This was a good solution only if this enabled/disabled state wasn't
particularly important to the function of the app. For example,
BBEdit used to store a little data in the resource fork about the
current cursor position and font size, but if that info got lost (as
could easily happen to a text file when transmitted by ftp, checked in/
out of subversion, etc.), it was no big loss -- it was just "extra"
data.
But if this is essential data, then I wouldn't consider this a very
good solution, as users who do transmit your files by ftp or try to
use them with svn or whatever will be disappointed when they break.
Without the resource fork, I can see only two solutions when I
iterate over each of these files. One is to open each file, read in
the data, determine if the function is enabled or not, close the
file, and then set the listbox. This is clearly a poor solution with
many hundreds of files to examine.
That's not so clear to me. If you can put this enabled/disabled flag
at the start of the file, then it will be no slower to open the file
and read that much of it than it would be to open the resource fork
and read that resource.
If not, then I agree it's a somewhat harder case... but probably still
not going to be so much slower that users would actually notice the
difference.
Best,
- Joe
--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|