keith@ssc-vax.UUCP (Keith Nemitz) (12/24/85)
...there I was just minding my own business when suddenly the toolbox blew up in my face. Could I have a round of "yes ModalDialog works as advertized" back at me. I can't for the life of me figure out why the following code kills me with error message #2. begin myDialog := GetNewDialog(DResNum,ADR(dRec),NIL); repeat ModalDialog(NIL,Item); until Item = 1; end It works fine if you comment out the call to ModalDialog. By working fine, I mean that resource dialog DResNum is drawn and it patiently waits forever. Otherwise the dialog gets halfway through being drawn and KABOOM! help! Keith Nemitz uw-beaver!ssc-vax!keith A9F4
rick@ut-ngp.UUCP (Rick Watson) (01/03/86)
> Could I have a round of "yes ModalDialog works as advertized" back at me. >I can't for the life of me figure out why the following code kills me with >error message #2. > begin > myDialog := GetNewDialog(DResNum,ADR(dRec),NIL); > repeat > ModalDialog(NIL,Item); > until Item = 1; > end Yes it works as advertised. BUT, please note that the behind parameter should be -1, not NIL. When all else fails, read the manual (Inside Macintosh) carefully. Rick Watson University of Texas Computation Center arpa: rick@ngp.UTEXAS.EDU rick@ngp.ARPA uucp: ...seismo!ut-sally!ut-ngp!rick rick@ut-ngp.UUCP bitnet: ccaw001@utadnx phone: 512/471-3241
carlile@trwrba.UUCP (Donald E. Carlile) (01/07/86)
In article <430@ssc-vax.UUCP> keith@ssc-vax.UUCP (Keith Nemitz) writes: > > Could I have a round of "yes ModalDialog works as advertized" back at me. Yes ModalDialog works! >I can't for the life of me figure out why the following code kills me with >error message #2. > > begin > myDialog := GetNewDialog(DResNum,ADR(dRec),NIL); > repeat > ModalDialog(NIL,Item); > until Item = 1; > end > > help! > Keith Nemitz > uw-beaver!ssc-vax!keith > A9F4 I have similar code that works. It goes like this: begin dialogP := GetNewDialog(whichDialog,NIL,pointer(-1)); . . repeat ModalDialog(nil,dItem); . . As you can see, our calls to ModalDialog are essentially identical. The difference must be in the GetNewDialog call. The differences there occur in where the dialog is stored and which window it appears behind. You have chosen to provide space for the dialog. The NIL in my code places it on the heap. Although I'm not positive, if the address you provide is not on the correct boundary, you could get error 2. The other difference is that you use NIL to indicate where you want the dialog drawn. IM specifies the pointer(-1) in order to put the dialog on top. I hope this helps. Don Carlile ...inhp4!trwrb!trwrba!carlile DISCLAIMER: The opinons expressed here are not neccessarily those of my employer.