[comp.sys.mac.programmer] Customizing SFGetFile: adding a button/multiple files

mesard@bbn.com (Wayne Mesard) (03/28/89)

I'm writing a simple application to process one or more (user-specified
files) and I want to make some changes to SFGetFile.  I have two
questions:

1) I want to add a check box to the bottom of the dialog box.  Since
this is a simple change, I thought it'd be better to use the standard
DLOG (ID = -4000) and add the control by hand (rather than building a
new dialog completely duplicating what's already in the System's
version).  That way, I retain compatibility with future versions of
SFGetFile.  So I put the following in my dialog hook:

    case firstTime:
	hCtl = GetNewControl(CENSOR_CTLID, (WindowPtr) dialog);
	OffsetRect(&((**hCtl).contrlRect), 0, dialog->portRect.bottom);
        dialog->portRect.bottom = (**hCtl).contrlRect.bottom + 5;
        break;

This gets the control inserted in the window, but item-hit events never
get generated for it (ie., my dialog hook doesn't get called when I
click on my new control).  This seems reasonable, since the number of
items is probably checked before the dialog hook is ever called. So, I
wound up creating a new DLOG after all, which can't be so bad, since its
what they do in TN47, but it just seemed wrong.  Am I being too anal
about this?

I have reason to believe it can be done, since LSC has a "Smart Link"
check box in the "Open Project" dialog, and looking through its resource
fork, I didn't see a replacement for the standard SFGetFile DLOG.

2) I want the user to be able to select multiple files (via shift-click
and command-click).  Assuming that item 7 (the file name list) uses the
list manager I should be able to do this if I can just get my hands on
the ListHandle (to modify the selFlags and to see which fields are
selected when the user hits Open).  Is this possible?  I'm not anxious
to rewrite the SFGetFile LDEF just because no one saw fit to give me
access to its data structure.  (Again, I'm assuming that it really does
use Mr. List Manager.)

Any tips appreciated. I will summarize all useful eMail responses.
Thanks in advance.

-- 
unsigned *Wayne_Mesard();
MESARD@BBN.COM           
BBN, Cambridge, MA       

svc@well.UUCP (Leonard Rosenthol) (03/29/89)

In article <37794@bbn.COM>, mesard@bbn.com (Wayne Mesard) writes:
> 2) I want the user to be able to select multiple files (via shift-click
> and command-click).  Assuming that item 7 (the file name list) uses the
> list manager I should be able to do this if I can just get my hands on
> the ListHandle (to modify the selFlags and to see which fields are
> selected when the user hits Open).  Is this possible?  I'm not anxious
> to rewrite the SFGetFile LDEF just because no one saw fit to give me
> access to its data structure.  (Again, I'm assuming that it really does
> use Mr. List Manager.)
> 
	No such luck on this one!  Standard File DOES NOT use the List Manager,
as it has been around MUCH longer than the LM and as such does it's own lists -
which are SINGLE SELECTION ONLY!
	If you need to have the user select multiple files, then you can do one
of two things (or both for that matter??):
1) Write your own StandardFile replacement.  Other products have done it to
solve this problem, and if you then replease it into the  public domain, maybe
more application willl adopt it for SF replacment.
2) Do a hack like what Stuffit does by keeping StandardFile up, but keeping a
list in the background of each file as it is selected and then waiting till
the user clicks on a 'done' button before working on all of the selected files.
(it's still one at a time selection, but you 'batch' them up)

-- 
+--------------------------------------------------+
Leonard Rosenthol        |  GEnie : MACgician
Lazerware, inc.          |  MacNet: MACgician
UUCP: svc@well.UUCP      |  ALink : D0025