[comp.sys.mac.programmer] Secret coding techniques

d83_sven_a@tekno.chalmers.se (SVEN AXELSSON) (10/16/89)

In article <8711@hoptoad.uucp>, tim@hoptoad.uucp (Tim Maroney) writes:
> In article <2426@tekno.chalmers.se> d83_sven_a@tekno.chalmers.se
> (SVEN AXELSSON) writes:
>>Hi.
> 
> Hello.
> 
>>I want to put a user-item into my custom SFGetFile dialog. How do I get the
>>user-item procedure connected? I can't do the usual GetItem - SetItem stuff
>>since SFPGetFile will read the dialog template for me. Is there a way of
>>handling this, short of writing my own filterProc - something I do NOT
>>want to do.
> 
> No.  But I don't see what's wrong with writing your own filter proc.
> Just type in the function definition from Inside Mac and pass the name
> of the function to SFPGetFile.  It's certainly no harder than writing a
> user item drawing procedure.
> 
> Your item filter procedure will get passed a -1 item for initialization.
> This is the time to do the GetDItem-SetDItem soft-shoe to bind the user
> item drawing procedure.  The entire function shouldn't take more than
> ten lines if this is all you're doing.
> -- 
> Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

OK, I've had a few answers similar to this one. What I meant was that I thought
I had to write my own DialogHook procedure - something altogether different
(sorry about the mixup). Actually I found out about the -1 item myself
shortly after my first posting in Apples source-code examples (SC018-StdFile).
The next question is then - where is this documented? Not in Inside Macintosh
at least (?) I suppose there are lots and lots of useful but not-too-well-
documented techniques for writing code. Is there a definite source for
finding them (loke a book or something)?

	Sven.

lim@iris.ucdavis.edu (Lloyd Lim) (10/17/89)

>The next question is then - where is this documented? Not in Inside Macintosh
>at least (?) I suppose there are lots and lots of useful but not-too-well-
>documented techniques for writing code. Is there a definite source for
>finding them (loke a book or something)?
>
>	Sven.

Here we go again.  Standard File is well documented in Tech Notes #47 and #80.
If you can read news, you almost certainly have access to at least some tech
notes.  The newest release of tech notes is posted on comp.binaries.mac very
quickly.  If you can ftp to apple or sumex you have access to ALL of the tech
notes.  If you don't have them you're really missing out on simple topics like
this (it's simple once you have the tech note).  Thanks to all the people who
keep looking out for us little guys and essentially keep tech notes free.

+++
Lloyd Lim     Internet: lim@iris.ucdavis.edu (128.120.57.20)
              Compuserve: 72647,660
              US Mail: 146 Lysle Leach Hall, U.C. Davis, Davis, CA 95616

tim@hoptoad.uucp (Tim Maroney) (10/17/89)

In article <2466@tekno.chalmers.se> d83_sven_a@tekno.chalmers.se
(SVEN AXELSSON) writes:
>OK, I've had a few answers similar to this one. What I meant was that I thought
>I had to write my own DialogHook procedure - something altogether different
>(sorry about the mixup).

No mixup.  What Inside Mac refers to as the "DlgHook", I was referring
to as a filter.  I commonly refer to dialog callbacks as item and event
filters.  Sorry for the confusion.  You do need to write your own
DlgHook, and it is very easy to do so.

>Actually I found out about the -1 item myself
>shortly after my first posting in Apples source-code examples (SC018-StdFile).
>The next question is then - where is this documented? Not in Inside Macintosh
>at least (?) I suppose there are lots and lots of useful but not-too-well-
>documented techniques for writing code. Is there a definite source for
>finding them (loke a book or something)?

The Macintosh Technical Notes.  You really can't do serious Mac
programming without them.  The -1 callback is documented in Tech Note
47, "Customizing Standard File".  In my opinion, there is nothing in
the technical notes which should not be in Inside Mac, but we all know
how seriously the Apple folks take my opinions.  A small amount does
get folded back into new volumes of Inside Mac when they come out, but
most doesn't.

Speaking of which -- given the massive expansion of models of the Mac
this year, we should be getting a new Inside Mac soon.  Any ideas on
when it's coming out?  If System 7.0 is 1st quarter 1990, then I guess
Inside Mac volume 6 will probably be 2nd quarter 1990.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

The fact is self-evident from the text and requires no supporting argument.