[comp.sys.mac.programmer] Help! 2 Mac programming questions

dtani@bbn.com (Dan Tani) (10/27/88)

Hi,

I've got two fairly simple Mac programming questions that I can't seem
to figure out.

1) How do I get an application to launch and then open a data file by double
clicking on that data file?

2) How do I animate cursors (like the spinning watch).  I looked into
the finder and found the cursors in a resource type acur or something
like that.  I have kludged an animated cursor by toggling from cursur
to cursor, but I have to make expicit calls to toggle.  Any way to
have the OS toggle for me?

Thanks for any help!

Dan Tani
DTANI@BBN.COM
Bolt Beranek & Newman Systems and Technologies Corp

tim@hoptoad.uucp (Tim Maroney) (10/28/88)

In article <31482@bbn.COM> dtani@BBN.COM (Dan Tani) writes:
>1) How do I get an application to launch and then open a data file by double
>clicking on that data file?

The application has to have a bundle, with all that entails (version resource,
bundle bit set, FREFs) and the bundle has to refer to an FREF for the file
type of the doucment file.  Also, the creator of the document has to be the
same as the creator of the application.

>2) How do I animate cursors (like the spinning watch).  I looked into
>the finder and found the cursors in a resource type acur or something
>like that.  I have kludged an animated cursor by toggling from cursur
>to cursor, but I have to make expicit calls to toggle.  Any way to
>have the OS toggle for me?

Nope, just keep doing it yourself.  No OS hooks for it.
-- 
Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim
"The Diabolonian position is new to the London playgoer of today, but not to
 lovers of serious literature.  From Prometheus to the Wagnerian Siegfried,
 some enemy of the gods, unterrified champion of those oppressed by them, has
 always towered among the heroes of the loftiest poetry."
    - Shaw, "On Diabolonian Ethics"

han@Apple.COM (Byron Han, Architect) (10/29/88)

In article <5775@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes:
>In article <31482@bbn.COM> dtani@BBN.COM (Dan Tani) writes:
>>1) How do I get an application to launch and then open a data file by double
>>clicking on that data file?
>
>The application has to have a bundle, with all that entails (version resource,
>bundle bit set, FREFs) and the bundle has to refer to an FREF for the file
>type of the doucment file.  Also, the creator of the document has to be the
>same as the creator of the application.
>
Also look at Inside Macintosh Volume II, chapter on Segment Loader about the
CountAppFiles which returns how many files were selected from the Finder
and opened (or printed).  GetAppFiles will return the names of the 
files as well as file type and volume reference number.

Note that under MultiFinder, if you double click on a file in the Finder
and the application is already open, patches are made to standard file
and a fake "Open" selection from the "File" menu is made.  Appropriate
details are available in the MultiFinder Developers Package I believe.

Hope this helps.
------------------------------------------------------------------------------
Byron Han, Communications Architect      The Journey Is The Reward...
Apple Computer, Inc.                     -------------------------------------
20525 Mariani Ave, MS27Y                 Internet: han@apple.COM
Cupertino, CA 95014                      UUCP:{sun,voder,nsc,decwrl}!apple!han
--------------------------------------   GENIE: BYRONHAN
ATTnet: 408-974-6450   Applelink: HAN1   CompuServe: 72167,1664
------------------------------------------------------------------------------