[comp.sys.mac.programmer] Dialogs in Init Code

soe@ames.arc.nasa.gov (Brad Soe) (01/10/89)

I am trying to display a dialog window in Init code, and am
having problems. Is there some limitations on the dialogs 
within init code. I just want to display a dialog with 
a static text item when the init boots up. I am using
aztec v3.6c. 

Brad Soe
soe@ames.arc.nasa.gov

bob@accuvax.nwu.edu (Bob Hablutzel) (01/10/89)

> I am trying to display a dialog window in Init code, and am
> having problems. Is there some limitations on the dialogs 
> within init code. I just want to display a dialog with 
> a static text item when the init boots up. I am using
> aztec v3.6c. 

Could of gotchas with dialogs in INIT code. First, you have to initialize
all of the managers, just like an application. This implies that you have
to allocate a block of storage for the quickdraw (and any other) global
variables. This would have to be 206 bytes (I think), plus any space for
your own global variables. Then you have to point A5 to the end of this space.
This is the tricky part, and might require some assembly code.

Finally, if you are planning on this code every running on an SE, you have
to clear out the global variable DeskHook. If this global variable is the
default -1, the machine will crash when the dialog is closed.

Good luck!

> Brad Soe
> soe@ames.arc.nasa.gov


Bob Hablutzel	BOB@NUACC.ACNS.NWU.EDU

erics@eleazar.dartmouth.edu (Eric Schlegel) (01/11/89)

In article <10050065@accuvax.nwu.edu> bob@accuvax.nwu.edu (Bob Hablutzel) writes:
>> I am trying to display a dialog window in Init code, and am
>> having problems. Is there some limitations on the dialogs 
>> within init code. I just want to display a dialog with 
>> a static text item when the init boots up. I am using
>> aztec v3.6c. 


I recall hearing that Mac DTS recommends not using the Dialog Manager during
INIT time. A better solution is simply to use QuickDraw directly to draw
the dialog.

eric
------
Eric Schlegel                 |  DISCLAIMER: I'm just a poor college student,
eric.schlegel@dartmouth.edu   |  which means I'm not responsible for what I
                              |  say and I can't pay you if you sue me anyway.

parent@Apple.COM (Sean Parent) (01/12/89)

In article <11712@dartvax.Dartmouth.EDU>, erics@eleazar.dartmouth.edu (Eric Schlegel) writes:
> In article <10050065@accuvax.nwu.edu> bob@accuvax.nwu.edu (Bob Hablutzel) writes:
> >> I am trying to display a dialog window in Init code, and am
> >> having problems. Is there some limitations on the dialogs 
> >> within init code. I just want to display a dialog with 
> >> a static text item when the init boots up. I am using
> >> aztec v3.6c. 
> 
> I recall hearing that Mac DTS recommends not using the Dialog Manager during
> INIT time. A better solution is simply to use QuickDraw directly to draw
> the dialog.

I would also not recommend putting up a dialog at init time because it will
blast out the show init icons. I would use show init and if more information
was needed then display a dialog after the machine is fully started. This could
be done with a patch to GetNextEvent or SystemTask. If you must display
something at startup then set up A5 and currentA5 and call InitGraph. Restore
A5 and current A5 on the way out. You could also init the rest of the system
after this and pop up a dialog. If you do this you will need to set deskHook
to nil and restore it on the way out.

Disclaimer: I do not recommend any of the above methods and they may break on
some future release.

Sean

urlichs@smurf.UUCP (Matthias Urlichs) (01/19/89)

In comp.sys.mac.programmer parent@Apple.COM (Sean Parent) writes:
< In article <11712@dartvax.Dartmouth.EDU>, erics@eleazar.dartmouth.edu (Eric Schlegel) writes:
< > 
< > I recall hearing that Mac DTS recommends not using the Dialog Manager during
< > INIT time. A better solution is simply to use QuickDraw directly to draw
< > the dialog.
< 
< I would also not recommend putting up a dialog at init time because it will
< blast out the show init icons.
Like AppleShare, for instance? :-)

Seriously, Apple should consider keeping to its own guidelines and
recommendations. I would rather want to know exactly how AppleShare does
go about displaying its dialog box, instead of telling us "you're not
supposed to do that".
< [...] display a dialog after the machine is fully started. This could
< be done with a patch to GetNextEvent or SystemTask.
If you just want to display something, I think you could use the
Notification manager. Would probably leave a small memory block lying around,
but patching GNE/ST would do that also. (You can't unpatch it because you
never know what went on after your patch.)
If it's more complicated, then it's probably a driver and doesn't need to
patch GNE/ST at all because it gets called at SystemTask time anyway...

< Disclaimer: I do not recommend any of the above methods and they may break on
< some future release.
So is AppleShare?

Disclaimer: This is just as chaotic as trying to get a dialog showing at
INIT time, although I wouldn't mind being proved wrong.
-- 
Matthias Urlichs -- Humboldtstrasse 7 -- 7500 Karlsruhe 1 -- FRG
urlichs@smurf.ira.uka.de -- ++49+721-621127@PTT