[comp.sys.mac.programmer] Weird Update with System 7

morris@mrcnext.cso.uiuc.edu (Brad Morris) (06/16/91)

Hi!  I am writing a game with a button and I use:
	SetCTitle(gButtonHandle,s);
This seemed to work fine under system 6, this procedure would set the
title and redraw the button.  In System 7, however, I get an
unexplainded update window event which seems to just redraw the
control whenever I call SetCTitle.  Did they change how the control
manager has handled this or do I have a really well hidden bug somewhere?
Thanks.

dweisman@umiami.ir.miami.edu (Ordinary Man) (06/16/91)

In article <morris.677036713@mrcnext.cso.uiuc.edu>, morris@mrcnext.cso.uiuc.edu (Brad Morris) writes:
> Hi!  I am writing a game with a button and I use:
> 	SetCTitle(gButtonHandle,s);
> This seemed to work fine under system 6, this procedure would set the
> title and redraw the button.  In System 7, however, I get an
> unexplainded update window event which seems to just redraw the
> control whenever I call SetCTitle.  Did they change how the control
> manager has handled this or do I have a really well hidden bug somewhere?
> Thanks.

Well, I'm not sure what might cause this off-hand, but here's how I deal with 
unexplained/unexpected update events. Just save the current port, set it to the 
window in question, call ValidRect(theWindow^^.portRect) and then set the port 
back. That will make sure the window doesn't get updated.

Dan

/-------------------------------------------------------------------------\
|   Dan Weisman -  University of Miami - Florida   |  ||   ||   ||   ||   |
|--------------------------------------------------|  ||   ||   ||\ /||   |
|   INTERNET  -----> dweisman@umiami.IR.Miami.edu  |  ||   ||   || | ||   |
|     BITNET  -----> dweisman@umiami               |  |||||||   || | ||   |
|-------------------------------------------------------------------------|
| "...the fact is- this friction will only be worn by persistance." -RUSH |
\_________________________________________________________________________/