[comp.sys.mac.programmer] General programming questions

system@asuvax.eas.asu.edu (Marc Lesure) (03/30/91)

I have several unrelated programming questions:

1)  Is it possible to display an icon and have it clipped rather than
    shrank/expanded to its Rect?

2)  Can a DA have a menu with a submenu in it?  The code :
		InsertMenu(sub, -1);
		SetItemCmd(main, item, 0x1B);
		SetItemMark(main, item, subID);
    Works fine for an application, but doesn't seem to work for a DA.

3)  Advise needed:  I've developed a DA which works fine on a SE, but
    bombs on a IIci (ID=11).  In general, what type of things should I
    look for to ensure the DA works on all platforms?

I'm still a novice at mac programming, so any advice/help would be
appreciated.

-----------------------------------------------------------------------
Marc Lesure / Arizona State University / Tempe, AZ
"Between the world of men and make-believe, I can be found..."
"False faces and meaningless chases, I travel alone..."
"And where do you go when you come to the end of your dream?"

UUCP:       ...!ncar!noao!asuvax!lesure  
Internet:   lesure@asuvax.eas.asu.edu

hairston@henry.ECE.CMU.EDU (David Hairston) (03/30/91)

[system@asuvax.eas.asu.edu (Marc Lesure) writes:]
[] I have several unrelated programming questions:
[]
[] 1)  Is it possible to display an icon and have it clipped rather than
[]     shrank/expanded to its Rect?

there are two options here:
PlotIcon uses CopyBits() to do its work.  you could:
a) imitate the PlotIcon() procedure in a custom procedure and use the
    the maskRgn parameter of the CopyBits() procedure to do the job or
b) use PlotIcon() and use the clipRgn of the portRect you're drawing into,
    if that applies.

[] 2)  Can a DA have a menu with a submenu in it?  The code :
[]		InsertMenu(sub, -1);
[]		SetItemCmd(main, item, 0x1B);
[]		SetItemMark(main, item, subID);
[]    Works fine for an application, but doesn't seem to work for a DA.

can't tell from what you've written here what went wrong.  let me take
a stab in the dark and say that you have to insert your main menu and
submenu and their menu ids must be in the range 236-255 to be recognized
as DA menus.  menu ids 0-235 are reserved for applications.  i'm not
sure if the system still reserves ids 0-127 in this case (haven't tested
it).  outside of that, i dunno ...

[] 3)  Advise needed:  I've developed a DA which works fine on a SE, but
[]    bombs on a IIci (ID=11).  In general, what type of things should I
[]    look for to ensure the DA works on all platforms?
[]
[] I'm still a novice at mac programming, so any advice/help would be
[] appreciated.

well, i'm new at this also.  my problems are usually backward
compatibility (i.e. trying to use color QuickDraw on 68000's, a no-no).
besides checking for particular features using a SysEnvirons like
call, i've always assumed that the toolbox was "machine independent".
to me, this means if you stick with toolbox calls and avoid assuming
things like such-and-such value is at so-and-so address, you're okay.

i'd have to see your code to give you a better hint about what went wrong.

  -dave-  
hairston@henry.ece.cmu.edu