trebor@biar.UUCP (Robert J Woodhead) (04/10/90)
Ok, so I need to add a custom button to the standard file dialog. Thats easy -- just copy the DLOG and DITL resources from the system file and edit them. The DLOGHook routine is easy too. No problem. Except... The hook routine just gets the item number and a pointer to the dialog. What I need to do is be able to set a flag so that my main program knows the extra button is pressed. It would be lovely to be able to diddle the SFReply field but no can do apparently. Which means i have to alter a global from within the hook routine. Which means futzing with the A5-WORLD. Unfortunatley, the recommended way to do this seems to change with every new set of tech-notes, and I for one have never been able to get it to work. Anyone run into this problem before and got a simple solution that works? PS: It seems really STUPID that the dloghook routine in SFGetFile can't touch SFReply! -- Robert J Woodhead, Biar Games, Inc. !uunet!biar!trebor | trebor@biar.UUCP Announcing TEMPORAL EXPRESS. For only $999,999.95 (per page), your message will be carefully stored, then sent back in time as soon as technologically possible. TEMEX - when it absolutely, postively has to be there yesterday!
bochner@speed.harvard.EDU (Harry Bochner) (04/12/90)
In article <1049@biar.UUCP>, trebor@biar.UUCP (Robert J Woodhead) writes: |>Ok, so I need to add a custom button to the standard file dialog. |>... What I |>need to do is be able to set a flag so that my main program knows the extra |>button is pressed. It would be lovely to be able to diddle the SFReply field |>but no can do apparently. Which means i have to alter a global from within the |>hook routine. Which means futzing with the A5-WORLD. I haven't done this in a long time, so maybe I'm out of date, but I don't think you need to worry about A5. Packages aren't DA's (despite some similarities), and as far as I know they run in the context of the application that called them. I did just what you're describing a few years ago, just writing into a global w/o worrying about A5, and it worked fine. I _think_ that program of mine runs under MultiFinder, but it's been a few years ... Harry Bochner bochner@endor.harvard.edu
oster@well.sf.ca.us (David Phillip Oster) (04/13/90)
In article <1049@biar.UUCP> trebor@biar.UUCP (Robert J Woodhead) writes: >Which means i have to alter a global from within the >hook routine. Which means futzing with the A5-WORLD. But, the hook routine is always run in a context where A5 is already set up correctly. If you can get at globals before you call SFGetfile(), you can get at your globals during SFGetFile(). THINK C makes it easy to get at globals, (except their SetUpA5() macro is not multi-finder compatible (or wasn't in version 3).) But, the general problem remains: How do you get at the globals. There is a stable tech note on setting up an A5 world in MPW. As for getting at it, I usually make LDEFs, CDEFs, WDEFs, etc be handles to code that looks like: JSR routineInMyApp that does the work rts application's A5 then the work routine allows for the extra address on the stack, (the different return address, pushed above the actual return address.) I have macros that expand to assembly language glue to save the calling a5 in a local, retrieve the application a5 from 2 after the return address, restore a5, and cleanup the stack ffor the procedure exit. -- -- David Phillip Oster - Note new address. Old one has gone Bye Bye. -- oster@well.sf.ca.us = {backbone}!well!oster