[comp.sys.apple] Why resources on the GS will [not] be _great_

kamath@reed.UUCP (Sean Kamath) (02/08/89)

In article <8901312219.aa10634@SMOKE.BRL.MIL> AWCTTYPA@UIAMVS.BITNET ("David A. Lyons") writes:
> [...]
>You've never felt the _need_ for a resource manager?  Have you ever
>written a desktop-based application?  (Or have you ever used a
>resource editor to customize menus and dialogs (among other things)
>in existing Macintosh application?)

Interresting, David.  Yes, the resource fork was designed for the Desktop
interface, simply because of the immense complexity of it.  Without a
resource fork, making menus, dialog boxes, etc., is a complete pain in the
butt.

> [background]
>
>Many kinds of resources can be edited interactively in an application
>called a resource editor (like ResEdit on the Mac).  Good examples
>are Icons, fonts, and templates for menus, windows, controls, dialog
>item lists, alerts, and dialogs.

all of which can lead to frighteningly strange desktops, where the whole
idea of the "common" interface is chucked out the window. . .

>Here's the kind of difference it makes.  The following Pascal code
>creates a modal dialog on the Apple IIgs...the hard way.  (This is
>excerpted from the source code from DIcEd (Desktop Icon Editor), a
>real live GS application.)

Well, it's in pascal. . . :-)

> [example]

>With resources, all that would be replaced by something like:
>
>  dlg := GetNewModalDialog(1);
>
>plus a few minutes spent interactively designing the dialog in a
>resource editor.  If you decide to move the items around, you just
>go back into the resource editor and move all the things where you
>want them.  (It's a _lot_ more fun than playing with lists of
>coordinates in SetRect calls!)

Keep in mind that you have to hard code resource numbers into the program.
A really good example of the confusion that arises in the the menu's.  You
create a menu id=1000, but you have to make sure that the ID is the code you
use.  Make any sense?  The menu id is the resource id you use to extract iut
from the file (i.e. the 1 in the GetNewModalDialog call) but to *use* the
damn thing, you have to user the ID if the menu. . .  Wee.

Not to mention what it takes to link resources together (i.e. including a
resource ICON into a DLOG box.  Make sure that you get the right numbers
where they belong!

Granted, a lot of the problem is with ResEdit, but sometimes it just the
whole concept.  If I'm building an application with menu's, and I decide to
add a menu item, say, to the beginning of a menu, then all the one's "down"
it change their number, and I have to recompile after finding all occurences
of the id number.  Granted, from C you just #define the number, and away you
go, but it get's damn confusing to keep up when you first start designing
the app.

If you have a nice development system, you can create a library (as we did
on our mac ]['s here at work) that you can request simple menu's an the
like.  Another system used here has easyxxxx where xxxx is menu's, windows,
etc.  You say "give me a window so big with the following attribute, and off
it goes.

>Since it's possible (on the Mac anyway) to have executable code in
>resources, there are some really keen things you can do:  You can
>let the user customize your program by adding code to it!

I.e. add the virus *very* easy . . . :-(

>--David A. Lyons              bitnet: awcttypa@uiamvs
>  DAL Systems                 CompuServe:  72177,3233
>  P.O. Box 287                GEnie mail:    D.LYONS2
>  North Liberty, IA 52317     AppleLinkPE: Dave Lyons


Let's not forget that the rest of the world doesn't have resource's, and
that such things as "mactar" only back up the data fork (lotta good that is,
as some app's store information about how the data is saved in the resource
fork!).

I'm not really all that against them. In the desktop environment, they can
be handy, I suppose.  But just as I now have a routine called
"init_the_world" which handle calling all the manager init's in the right
order (why o why didn't they create a toolbox call of this sort?  Ever read
inside mac?  init thatbefore you init this, but only after initing this,
which will then allow that to . . ."  Yuk.

Then we see tha 400meg application builders like "macapp" come along. . .
Wee.

No thanks.  I have my 65816 option with a meg 'o RAM in now. And the SCSI
disk I pick up thursday.

Have a nice day!

Sean
-- 
UUCP:  {decvax allegra ucbcad ucbvax hplabs}!tektronix!reed!kamath
CSNET: reed!kamath@Tektronix.CSNET  ||  BITNET: kamath@reed.BITNET
ARPA: kamath%reed.bitnet@cunyvm.cuny.edu
US Snail: 3934 SE Boise, Portland, OR  97202-3126 (I hate 4 line .sigs!)