Path: utzoo!attcan!uunet!cadnetix.COM!cadnetix!pem From: pem@cadnetix.COM (Paul Meyer) Newsgroups: comp.sys.mac.programmer Subject: Re: Help! Keywords: MoveControl(), CopyBits() Message-ID: <10929@cadnetix.COM> Date: 12 Jan 90 22:06:53 GMT References: <16747@megaron.cs.arizona.edu> Sender: news@cadnetix.COM Reply-To: pem@cadnetix.COM (Paul Meyer) Organization: Cadnetix Corp., Boulder, CO Lines: 41 In article <16747@megaron.cs.arizona.edu> gerhard@cs.arizona.edu (Gerhard Mehldau) writes: >I have two (unrelated) problems that I hope someone out there >can help me solve: > >(1) I'm trying to use the same DLOG/DITL resource for several > related dialogs. This requires that a button be shifted > slightly before the dialog is displayed. I'm calling > GetNewDialog(...) to read in the resources, then > GetDItem(...) to get the button's handle and > MoveControl(...) to move the button, and finally > ShowWindow(...) to display the dialog. The button > is drawn in the correct location, but when I do a > ModalDialog(NULL,...) and try to click on the button, > the Dialog Manager only reacts if the mouse is in the > *intersection* of the old and new rectangles. What > am I doing wrong? This is because you are only changing the position of the control, not the rectangle of the controlItem. The Dialog Manager keeps track of the rectangles of all the stuff in the dialog and does hit-checking of enabled items. If the item is a control, it passes the mouse event on to the Control Manager to process. You need to add one more call to your sequence: GetNewDialog GetDItem MoveControl SetDItem (OffsetRect the Rect you got from GetDItem the same amount you moved the control in MoveControl) ShowWindow, etc. Similar problems can occur when you change the hilighting of a control and don't change the corresponding DItem enabled status--I suspect that leaving a grayed-out control enabled would do the right thing (since you can click on a control then drag out of it and the Dialog Manager won't call that an item hit), but if you un-gray a control without re-enabling it as a dialog item the mouse hit will never be passed on to it. Paul Meyer pem@cadnetix.COM Daisy/Cadnetix Inc. (DAZIX) {uunet,boulder}!cadnetix!pem 5775 Flatirons Pkwy. GEnie P.MEYER CI$ 73627,1274 Boulder, CO 80301 (303)444-8075x277