[comp.sys.mac.programmer] How to Border Default Button in SFGetFile + SFPutFile?

topix@gpu.utcs.utoronto.ca (R. Munroe) (07/25/90)

I think this question has been asked here before but I forgot to keep
the reply ... sorry.

What I am looking for is a tip on how to implement a hook that will
border the default button (Open/Save) in SFGetFile and/or SFPutFile.

Any hints would be humbly appreciated (I'm using THINK C). Thanks.

Bob Munroe
topix@utcs.utoronto.ca

jeremyr@cs.qmw.ac.uk (Jeremy Roussak) (07/26/90)

In article <1990Jul25.071908.22728@gpu.utcs.utoronto.ca> topix@gpu.utcs.utoronto.ca (R. Munroe) writes:
>I think this question has been asked here before but I forgot to keep
>the reply ... sorry.
>
>What I am looking for is a tip on how to implement a hook that will
>border the default button (Open/Save) in SFGetFile and/or SFPutFile.
>
A simple way is to make a copy of the SF{Pu/Ge}tFile dialog (the
details of all the DITL items are in IM-I), add an outline and then
use SFPPutFile/SFPGetfile with your new dialog ID.

The border drawing has been discussed here recently.  Three approaches
are:

1. A user item with some code that draws the outline.
2. A PICT with the outline in it (less flexible, but requires no code
   and is automatically updated for you)
3. Default CDEF (available free from sumex - recommended)

Hope this helps

Jeremy Roussak

kk@mcnc.org (Krzysztof Kozminski) (07/26/90)

In article <2568@sequent.cs.qmw.ac.uk> jeremyr@cs.qmw.ac.uk (Jeremy Roussak) writes:
|In article <1990Jul25.071908.22728@gpu.utcs.utoronto.ca> topix@gpu.utcs.utoronto.ca (R. Munroe) writes:
|>What I am looking for is a tip on how to implement a hook that will
|>border the default button (Open/Save) in SFGetFile and/or SFPutFile.
|>
|A simple way is to make a copy of the SF{Pu/Ge}tFile dialog (the
|details of all the DITL items are in IM-I), add an outline and then
|use SFPPutFile/SFPGetfile with your new dialog ID.

I think it's a bad idea - when Apple updates their dialog, you have
to redo your work.  If new items are added by Apple, your application
with the old dialog may run into item number conflict, with possible
dire results, if. e.g., the new version of SF package thinks that the
userItem you've added is a control (as it may be in the new version
of the dialog...).

IMHO, the right way is to add new items on the fly, in a similar manner as
described for print dialogs in TN #95 (I think this is the correct number),
that is, by appending a DITL to a dialog that has been already read into
memory.  This is done in the dialog hook upon initialization (when it
gets item number -1).

|The border drawing has been discussed here recently.  Three approaches
|are:
|
|1. A user item with some code that draws the outline.
|2. A PICT with the outline in it (less flexible, but requires no code
|   and is automatically updated for you)
|3. Default CDEF (available free from sumex - recommended)

One more that I haven't seen: use the dialog event filter function to
draw the frame when it gets an update event.

KK
-- 
Kris Kozminski   kk@mcnc.org
"The party was a masquerade; the guests were all wearing their faces."