[comp.sys.mac.programmer] Changing complicated Dialogs into Windows

rothberg@polya.Stanford.EDU (Edward Rothberg) (10/01/88)

I've just finished reading what TechNote 203, "Managerial Abuse" has to
say about the Dialog Manager.  While I agree with its message, that
the Dialog Manager is meant for simple dialogs and anything the least
bit complicated should be done with the Window Manager, I can't seem to
figure out how to apply it.  I use ResEdit for resource creation and
editing.  As it is right now, I find it extremely cumbersome to put
just a few controls in a window.  For me, it involves a number of
iterations of:
    Start ResEdit
    Put the control at a certain coordinate
    Quit ResEdit
    Start LightSpeed C
    Try program
    See how far control is from where you want it
    Quit LightSpeed C
    Return to ResEdit
    ...
I couldn't imagine doing this for a large number of controls (i.e.
a complicated Dialog which should be done with the Window Manager).
What I'm wondering is: what am I doing wrong?  Is there an easier
way to do this that I don't know about?  ResEdit allows me to easily
preview what a dialog will look like, so I can fine tune it without
exiting ResEdit.  I can't see how to do this with a Window.

I realize that this is probably easy to do using Rez in MPW, since
it's within the environment.  I also realize that it would be
easier if I were using MultiFinder (with $800 more of memory).
What I'm wondering is if there's a non-painful way to do it using
ResEdit and UniFinder.

Ed Rothberg
rothberg@polya.stanford.edu

bob@eecs.nwu.edu (Bob Hablutzel) (10/03/88)

> I couldn't imagine doing this for a large number of controls (i.e.
> a complicated Dialog which should be done with the Window Manager).
> What I'm wondering is: what am I doing wrong?  Is there an easier
> way to do this that I don't know about?  ResEdit allows me to easily
> preview what a dialog will look like, so I can fine tune it without
> exiting ResEdit.  I can't see how to do this with a Window.

I recently came across the same problem - creating what looks like 
a dialog, but isn't (actually, it isn't even a window...). The way I
settled on was to use ResEdit to create a DITL resource, then parse
out the DITL myself. Not to hard to do, and much easier than fudging
each individual control. When you're done, if you want, you can break
the DITL into it's componants, and create each resource seperately. Up
to you.

Bob Hablutzel		BOB@NUACC.ACNS.NWU.EDU
Disclaimer:	My bosses wouldn't know what a DITL was, and would
		probably ask me to stop messing with them if they did.

ech@poseidon.UUCP (Edward C Horvath) (10/04/88)

From article <4209@polya.Stanford.EDU>, by rothberg@polya.Stanford.EDU (Edward Rothberg):
> I've just finished reading what TechNote 203, "Managerial Abuse" has to
> say about the Dialog Manager...As it is right now, I find it extremely
> cumbersome to put just a few controls in a window...

Try a different tack: design your window using the DLOG/DITL tools to get
the "look" you want, then manually copy the item coordinates into an RMaker
script that you compile for use by LSC.

You're right, the MPW rez/derez tools make this a far easier task (derez
will dump the DITL, which can then be easily massaged into a set of
Control descriptions, and compiled with rez).

But there is nothing mysterious about the way the Dialog Manager 
interprets DITLs: the resource format is documented in Inside Mac.
Consider painting windows by reading a DITL and interpreting it yourself.

=Ned Horvath=

shap@polya.Stanford.EDU (Jonathan S. Shapiro) (10/06/88)

I have seen several postings re: TechNote 203, so I went over to
CompuServe to get them. No sign. Can anyone tell me where I can pick
up technotes after 183, which is (I think) about the last one I have
got?  Nothing on CompuServe has been added for a long time

amanda@lts.UUCP (Amanda Walker) (10/06/88)

I have found that the Dialog Manager is only really useful for modal
dialogs and very, very simple modeless ones.  For a modeless dialog
of any complexity, it's easier to treat it as a window, as far as the
programming effort goes.  The biggest advantage of using the Dialog Manager
is that you can use things like ResEdit to design and/or customize the
dialog's appearance.  If you're doing everything yourself, you don't
get this advantage, unless you (as several people suggest) write code
to parse DITLs yourself.

Another approach, which is most useful for people who are working in Pascal,
is to use Prototyper from Smethers-Barnes.  Yes, it has a few bugs, but
it will let you lay out a window a little more easily than ResEdit, and
then generate the code and CNTL resources for it.  It will handle all of
the standard dialog components, as well as lines and boxes, scrolling lists,
multiple fonts, icon buttons (which are an interesting idea), and so on.

It's often easier to take working but ugly code and clean it up that to
start from scratch...

Now all they have to do is generate MPW C, and I'll be a happy camper :-).

--
Amanda Walker			UUCP:	...!uunet!lts!amanda
InterCon Corporation		Domain:	lts!amanda@uunet.uu.net
11732 Bowman Green Drive			OR
Reston, VA 22090			amanda%lts@uunet.uu.net

lsr@Apple.COM (Larry Rosenstein) (10/08/88)

In article <713@lts.UUCP> amanda@lts.UUCP (Amanda Walker) writes:
>programming effort goes.  The biggest advantage of using the Dialog Manager
>is that you can use things like ResEdit to design and/or customize the
>dialog's appearance.  If you're doing everything yourself, you don't
>
>Another approach, which is most useful for people who are working in Pascal,
>is to use Prototyper from Smethers-Barnes.  Yes, it has a few bugs, but

MacApp 2.0 takes the approach mentioned in the Tech Note.  For anything
other than a simple alert, it doesn't use the Dialog Manager at all.

Instead, there are individual view objects for each of the elements that can
be put into a dialog.  This not only includes the usual things (buttons,
check boxes, etc.) but also other things such as popup menus, icons,
pictures, and clusters.  (The latter are usefule because any radio buttons
inside a cluster are made mutually exclusive automatically.)

The layout of these dialogs is stored in a 'view' resource.  There is an
alpha release of a program that lets you create these resources
interactively. 

		 Larry Rosenstein,  Object Specialist
 Apple Computer, Inc.  20525 Mariani Ave, MS 46-B  Cupertino, CA 95014
	    AppleLink:Rosenstein1    domain:lsr@Apple.COM
		UUCP:{sun,voder,nsc,decwrl}!apple!lsr

amanda@lts.UUCP (Amanda Walker) (10/11/88)

In article <18456@apple.Apple.COM>, lsr@Apple.COM (Larry Rosenstein) writes:
> [quick description of MacApp dialog handling]
> 
> The layout of these dialogs is stored in a 'view' resource.  There is an
> alpha release of a program that lets you create these resources
> interactively. 

Sounds good.  I have a couple questions:

  a) is it possible to get a description and/or Rez template for 'view'
     resources?  Preferable without having to buy MacApp 2.0 :-)?

  b) is it possible to get a copy of the aforementioned editing program?

I don't like reinventing wheels, you see, but I'm not yet convinced that
MacApp is The One True Way, either...  It does seem that this particular
piece has a lot of application beyond MacApp, though.


Thanks,

Amanda Walker				...!uunet!lts!amanda
InterCon Corporation				  OR
11732 Bowman Green Drive		lts!amanda@uunet.uu.net
Reston, VA 22090