[comp.sys.mac.programmer] FKEYs and resources

jeremyr@cs.qmw.ac.uk (Jeremy Roussak) (04/20/91)

I'm writing an FKEY which may bring up a dialog.  Given that an FKEY 
doesn't know what resource files may or may not be open when it's run,
what's the best place to keep its resources?

The system file is one possibility, but there's no ownership scheme for
FKEYs, so ID conflicts are likely.  Also, I'd have to install them in
the system file which means using the installer and seems rather OTT.

More likely, I could put an FKEY resources file in the system folder.
This seems better, but I have to insist that the file isn't renamed
as there's no easy way to find it after a rename (index through the
system folder looking for a file with my creator? ugh).

So, does anyone have any ideas?

Jeremy Roussak

mxmora@unix.SRI.COM (Matt Mora) (04/24/91)

In article <3572@sequent.cs.qmw.ac.uk> jeremyr@cs.qmw.ac.uk (Jeremy Roussak) writes:
>
>I'm writing an FKEY which may bring up a dialog.  Given that an FKEY 
>doesn't know what resource files may or may not be open when it's run,
>what's the best place to keep its resources?
>
>The system file is one possibility, but there's no ownership scheme for
>FKEYs, so ID conflicts are likely.  Also, I'd have to install them in
>the system file which means using the installer and seems rather OTT.

I think that is a really bad idea and should be avoided. I don't think
Apple likes it either.

>More likely, I could put an FKEY resources file in the system folder.
>This seems better, but I have to insist that the file isn't renamed
>as there's no easy way to find it after a rename (index through the
>system folder looking for a file with my creator? ugh).

I just create (or have the user install) the file in the system folder.
Its not an init so it shouldn't have to be renamed. If the user does rename
the file then display an alert saying "can't find the file".

(not that my way is the correct way ...)
 
What I plan to do is make my fkey pref file a cdev so that the user
can use the control panel to change some of the options.

Apple is thinking about not supporting fkeys. Or at
least making them "Reserved for Apples use". Just though I should warn you.


Matt





-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________

jeremyr@cs.qmw.ac.uk (Jeremy Roussak) (04/25/91)

In an earlier article, I wrote:
>
>I'm writing an FKEY which may bring up a dialog.  Given that an FKEY
>doesn't know what resource files may or may not be open when it's run,
>what's the best place to keep its resources?
>
>The system file is one possibility, but there's no ownership scheme for
>FKEYs, so ID conflicts are likely.  Also, I'd have to install them in
>the system file which means using the installer and seems rather OTT.
>
This method got no votes at all, as I'd anticipated.

>More likely, I could put an FKEY resources file in the system folder.
>This seems better, but I have to insist that the file isn't renamed
>as there's no easy way to find it after a rename (index through the
>system folder looking for a file with my creator? ugh).
>
There were a few votes for this method, giving up gracefully if
the file can't be found.  Matt Mora pointed out that the file
isn't an INIT, so there shouldn't be any need for anyone to
rename it.  Not that that's ever stopped anyone :-)

Most votes were for building the dialog on the fly using
NewWindow, NewControl etc.  One ingenious solution was to leave
some space (with dc.l 0 a few times) within the FKEY and use
ResEdit to paste the dialog into it.

I'll probably go for the system folder file method.

Many thanks to all who responded.

Jeremy Roussak