luke@tasis.utas.oz.au@munnari.oz (Luke Visser) (08/29/89)
Ok I can't see an elegant solution to my problem so I'll see if those on the net can. The problem is to get the folder name of a selected folder from SFGetFile in a cdev. The SFReply record that you pass into SFGetFile returns the vRefNum of the folder that contains the selected file/folder which is useful but not what I want. In IM IV there is this comment: "Before the dlgHook routine is called, information for the selected file or *folder* is stuffed in the reply record ... ... If a folder is selected, fType will contain the dirID." Since the dlgHook routine is called with the dialogPtr and an item as parameters it is not possible to get at the reply record unless it is global, which being a cdev is impossible. So how to get the reply record into the dlgHook routine? My initial reaction was to used the refCon field of the dialogPtr to pass in a handle to the reply record and work from there, but as SFGetFile loads the dialog that is impossible. From what I can see the SFGet dialog is the only means of communicating the information I want but since I cannot get at it before SFGetFile gets called that's nigh on impossible. The only (to me) legitimate but (really) dirty method that was suggested to me is to add in an invisible user item into the SFGet dialog. Load it, store the handle to the reply record in it, call SFGetFile, get the value out in the dlgHook routine, mung it, put it back and then get it out when it has returned. This is gross! It means that the cdev will modify itself every time that it has to put the SFGetFile dialog box. So, if you can see a more elegant and cleaner solution drop me a line, Luke Visser --------------------------------------------------------------------------- "I'm a Tasmanian" - Albert Einstein Snail: Uni of Tasmania, Box 252C GPO, Hobart 7001, Tasmania, Australia. ACSnet: luke@tasis.utas.oz ARPA: luke%tasis.utas.oz@uunet.uu.net UUCP: {enea,hplabs,mcvax,uunet,ukc}!munnari!tasis.utas.oz!luke