Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!news.sei.cmu.edu!cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!agate!news.ossi.com!news.fujitsu.com!amdahl!netcomsv!ix.netcom.com!netcom.com!altinbay
From: altinbay@netcom.com (John Altinbay)
Subject: Bringing up a Mac file dialog from VisualWorks
Message-ID: <altinbayCx86Bu.4Fp@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
Date: Thu, 6 Oct 1994 00:21:29 GMT
Lines: 41

Has anyone dealt with the VisualWorks interface to the Macintosh
file dialogs?  I am porting a product based on VW to the Mac.
The native file dialogs are being used on the platforms.  I have
run into problems in both the Open file dialog and the Save As
dialog.

The Open dialog comes up fine using MacOSFilename class >> getFileTypes:.
However, it comes up on whatever directory (OK, folder) was being
displayed the last time a dialog was up.  Many parts of the product
have specific locations relative to where the image resides that
contain files that are interesting at that place in the product, and
I need to be able to bring up the dialog on a specific folder.
Note that the argument to getFileTypes: is an array of file types
to show.

The Save As dialogis brught up using MacOSFilename >> putFileWithPrompt:.
Note that the message is sent to an instance of MacOSFilename.
There are two instance variables, nameString and volumeReference.
They must both be assigned before putFileWithPrompt: can be sent to
an instance without a primitive failure.  nameString is OK - it is
the default filename that shows in the type in field when the dialog
is brought up.  volumeReference is a SmallInteger, a "handle" for
a folder.  I can't find anything that will assign this except
MacOSFilename class >> getFileTypes:.  That method returns a
MacOSFilename instance that contains the volumeReference for the
folder from which the file was selected.

I have stashed away such a volumeReference when a file is opened,
but there is no guarantee that a user will open any files.  A user
might create a new somethingorother and want to save it.  So we
could encounter the primitive failure.

If anyone has figured this stuff out, please let me know.  I realize
I may have to go into CPOK and write some primitives myself.  I hope
not.
 
-- 
John Altinbay   -   altinbay@netcom.com   anon-1014@twwells.com
===============================================================
There's a spirit that guides me, a light that shines for me
My life is worth the living, I don't need to see the end.
