[comp.sys.mac.programmer] Several MAC programming questions

marty@june.cs.washington.edu (Marty Sirkin) (02/10/89)

I have several programming questions which I cannot find simple answers to,
and which I expect some wise person on the net can answer quite quickly.
Here goes:

1)  Is there any way to "remove" quickdraw calls from a picture definition?
      (clearly one could build a list of the quickdraw calls, and rebuild
       the picture, but I'm looking for something simpler).

3)  I defined a simple modal dialog with ResEdit, and put the following 
     code in a procedure:

VAR
   t_ptr : dialogptr;

BEGIN
   t_ptr := getnewdialog(dial_num, NIL, windowptr(-1));
   showwindow(t_ptr)

I get the dialog (mostly) just fine.  But for some reason, the STATIC
text items did not appear!  I defined them as DITL items which were static
text, and non-enabled.  I have further, another dialog in which only some
items appear (the static and editable text do not), and when I try to
highlight one of the items, the system gets an address error (it seems to
be getting a bad address back from the getditem call.

Any ideas?  I appreciate any and all help.  Posting, or E-mail.

						Marty Sirkin

topping@dinghy.cis.ohio-state.edu (brian e. topping) (02/12/89)

in reply to your first question...
> 1)  Is there any way to "remove" quickdraw calls from a picture definition?
>      (clearly one could build a list of the quickdraw calls, and rebuild
>       the picture, but I'm looking for something simpler).

I'm not sure if this is what you are after, but you can convert an "object"
PICT to a bitmap PICT by finding the rectangle of where the picture will be
drawn, draw the picture normally, then call _OpenPicture to set up a new
picture.  Pretty standard so far.  Everything you do with QuickDraw now is
saved in this picture definition.  At this point doing a _CopyBits from
anywhere to anywhere (I use the same rectangle for both) will save those bits
that compose the picture as a bitmap in the picture definition you have 
started with _OpenPicture.  Since the bitmap is all you want, call 
_ClosePicture and then you can do waht you want with the handle, probably
_AddResource.  I do this conversion offscreen so the user is not annoyed by
flashing pictures (subliminal messages??)  -bri

wiechman@athos.rutgers.edu (NightMeower) (02/13/89)

In article <7236@june.cs.washington.edu> marty@june.cs.washington.edu (Marty Sirkin) writes:

> 1)  Is there any way to "remove" quickdraw calls from a picture definition?
>       (clearly one could build a list of the quickdraw calls, and rebuild
>        the picture, but I'm looking for something simpler).


Each grafport has a set of drawing routines attached to it called
grafProcs of type QDProcsPtr.  Color grafports similarily have
CQDProcsPtr.  When first opened grafProcs points to the standard Apple
routines.  To get rid of any and all text (unless the text is part of
a bitmap), set grafProcs^.textProc := @myTextProc.  

myTextProc is an empty procedure, but make certain that you accept the
same parameters as the Apple routines.

You can override any of the drawing routines this way.


Kevin
-- 
===========================================================================
Kevin S. Wiechmann			arpa:  wiechman@rutgers.rutgers.edu

	 This is only a test... for the next sixty seconds...