[comp.sys.mac.programmer] Multifinder problem

jamesm@sco.COM (James M. Moore) (01/19/89)

In article <2314@ilium.cs.swarthmore.edu> jackiw@ilium.UUCP (Nick Jackiw) writes:
>When User shutsdown or restarts from the Finder, MultiFinder attempts to
>QUIT your opened app by looking in the FILE menu for a "QUIT" item. Likewise,
>when User double-clicks a doc tied to your app when your app is running, it
>feeds your application as Mousedown in the MENU bar, and then forces
>_MenuSelect to return the item# of your "OPEN" command.  This usually is 

How does it tell which is which?  I hope it doesn't do something
foolish like look for the strings "Quit" and "Open," as not all
software is written in English.  (If it does do something this
braindead, could someone plese tell me how to modify this string from my
code?)

-- 
** James Moore **
** Internet:  jamesm@sco.com **
** uucp:  {decvax!microsoft | uunet | ucbvax!ucscc | amd}!sco!jamesm **
** Nil clu no suim ar bith ag SCO ceard a bhfuil me ag scriobh anois. **

phil@mit-amt (Phil Sohn) (01/19/89)

In article <1322@viscous.sco.COM> jamesm@sco.COM (James M. Moore) writes:
>In article <2314@ilium.cs.swarthmore.edu> jackiw@ilium.UUCP (Nick Jackiw) writes:
>>When User shutsdown or restarts from the Finder, MultiFinder attempts to
>>QUIT your opened app by looking in the FILE menu for a "QUIT" item.
>
>How does it tell which is which?  I hope it doesn't do something
>foolish like look for the strings "Quit" and "Open," as not all
>software is written in English.  (If it does do something this
>braindead, could someone plese tell me how to modify this string from my
>code?)

	Well, it does do something braindead like looks for Quit under
the File menu.  However, it is rather smart about the way it does it,
looking first for a mst# resource that has the same format as a `STR `
resource.  The resources are:

100	Name(s) of the menu containing the quit command
101	Name(s) of the menu item corresponding to the quit command 
102	Name(s) of the menu containing the open document command
103	Name(s) of the menu item corresponding to the open document command 

	For more info check out Tech Note 205 Multifinder Revisited.


						phil@ems.media.mit.edu

ech@pegasus.ATT.COM (Edward C Horvath) (01/20/89)

In <2314@ilium.cs.swarthmore.edu> jackiw@ilium.UUCP (Nick Jackiw) writes:
!When User shutsdown or restarts from the Finder, MultiFinder attempts to
!QUIT your opened app by looking in the FILE menu for a "QUIT" item. Likewise,
!when User double-clicks a doc tied to your app when your app is running, it
!feeds your application as Mousedown in the MENU bar, and then forces
!_MenuSelect to return the item# of your "OPEN" command.  This usually is 
 
The latter is not quite right: it jams an Open, then intercepts the call
to SFGetFile and feeds back the selected file in the SFReply.

In <1322@viscous.sco.COM> jamesm@sco.COM (James M. Moore) writes:
! How does it tell which is which?  I hope it doesn't do something
! foolish like look for the strings "Quit" and "Open," as not all
! software is written in English.  (If it does do something this
! braindead, could someone plese tell me how to modify this string from my
! code?)

It does something precisely that "braindead."  Makes sense to me, they
wanted as many existing applications as possible to inherit this nifty
feature.

However, they did not do anything as "braindead" as to expect YOU to hack up
THEIR system, or somebody else's apps.  Instead, they provided a mechanism
to override: extracted from TN 205 (8/88, rev'd 12/88):

mstr 100 (mst# 100):	name(s) of the menu containing the quit command
mstr 101 (mst# 101):	name(s) of the menu item for the quit command
mstr 102 (mst# 102):	name(s) of the menu containing the open command
mstr 103 (mst# 103):	name(s) of the menu item for the open command

with a caveat that you shouldn't get too clever.  See the full TechNote
for details.  mstr (mst#) resources are structured identically to
STR (STR#) resources, use "Open as..." from ResEdit.

BTW, I've successfully added mstr's to existing applications, with sanguine
results.  The drawback in many cases is that lots of applications disable
'Open' when there's an open document; a friendlier programming technique is
to either support multiple documents, or do an implicit Close first when
Open is selected.

=Ned Horvath=

lsr@Apple.COM (Larry Rosenstein) (01/21/89)

In article <3493@mit-amt> phil@media-lab.media.mit.edu (Phil Sohn) writes:

>looking first for a mst# resource that has the same format as a `STR `

Actually a mst# resource has the same format as a STR# resource, and a mstr
resource is the same as a 'STR ' resource.  You would use the mst# if your
application changes the name of a menu item for some reason.


-- 
		 Larry Rosenstein,  Object Specialist
 Apple Computer, Inc.  20525 Mariani Ave, MS 46-B  Cupertino, CA 95014
	    AppleLink:Rosenstein1    domain:lsr@Apple.COM
		UUCP:{sun,voder,nsc,decwrl}!apple!lsr