[net.micro.mac] Using Dialogs in DA's

tools@tektronix.UUCP (Tom Milligan) (11/13/85)

I tried posting this from one of our other machines, but I don't think
it made it out.  So, if this is something you've seen before, sorry...

I am trying to use a Modal Dialog Box within a DA, and trying to process
it using the ModalDialog toolbox call.  Unfortunately, this doesn't seem
to work very well, resulting in system crashes.  Has anyone done this 
successfully?  If so, I would
appreciate some pointers.

A brief skeleton of how I'm (unsuccessfully) trying to do it (in Aztec C)
is as follows:

	open()
	{
		.
		.
		DCEPtr->dCtlWindow = GetNewDialog(...);
		.
		.
	}

	control()
	{
		.
		.
		switch (event) {
		case accEvent:
			SelectWindow(DCEPtr->dCtlWindow);
			if (firsttimethrough) {
				ModalDialog(...);
			}
		.
		.
		.
	}

A code fragment from someone who has done this would be great.  Lacking that
however, good ideas are most welcome.

			Thanks,

			Tom Milligan
			tektronix!tekig5!tomm

berry@tolerant.UUCP (David Berry) (11/20/85)

> I am trying to use a Modal Dialog Box within a DA, and trying to process
> it using the ModalDialog toolbox call.  Unfortunately, this doesn't seem
> to work very well, resulting in system crashes.  Has anyone done this 
> successfully?  If so, I would
> appreciate some pointers.
> 
> 	open()
> 	{
> 		.
> 		.
> 		DCEPtr->dCtlWindow = GetNewDialog(...);
		DCEPtr->dCtlWindow->windowKind = DCEPtr->dCtlRefNum;
> 		.
> 		.
> 	}

	The setting of windowKind must be done regardless (as far
as I've been able to determine) how the window is going to be used
if you expect/want it's events to get back to the DA.  In fact, some
applications will probably puke all over you if you don't since the
will be trying to do updates on windows which they don't recognize
and/or know what to do with.  How to prevent your application from
being bombed by some DA that doesn't handle it's windows correctly
is another problem entirely.  Basically though you should ignore
any window events that don't belong to a window you know about.
-- 

	David W. Berry
	...!ucbvax!tolerant!berry

	[Don't shoot the Tolerant Systems, I'm just the consultant]