🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.mac
Article #6692

Re: problem with regions

#6692
From: Paul DuBois
Date: Wed, 06 Aug 1986 12:40
33 lines
2326 bytes
> Here is a problem I am having with regions:
> 
> I create a region and set it equal to a rectangle with a call to RectRgn.
> I then check to see if the mouse is clicked within the region and
> if it is, I call DragGrayRgn with a  nil for the actionProc. After
> dragging the region across the window, I release the mouse button. If I
> try to drag the region again, however, I find that the region is
> defined as the frame, not the enclosed area of the rectangle.  
> 
> What gives?!! I have to grab it by its border (PtInRgn is true for only
> this condition).  Obviously I want the region to remain unchanged.

Amazing how these coincidences happen...  Presumably this is a
description of the same problem Greg Stein is having.  I just checked
it out myself, and indeed, DragGrayRgn not only returns the
horizontal and vertical offsets of the drag in the result value, IT
CHANGES THE REGION THAT IS PASSED TO IT!

Phonebook IM gives no hint that this behavior will occur.  It just says
that an outline of the region will be dragged around, with no indication
that the region passed in will either be moved or changed in character.

Moral:  pass a COPY of the region you want to drag, then after
DragGrayRgn returns, offset the original region by the amounts in the
return value, if it's not a bad drag.  Remember that the code for a bad
drag is not $8000, as the phonebook IM says, but $80008000 (i.e., $8000
in both the high and low words - fixed in Addison-Wesley edition).
-- 
Paul DuBois     UUCP: {allegra,ihnp4,seismo}!uwvax!uwmacc!dubois    |
                ARPA: dubois@easter                               --+--
                                                                    |
Begin at my sanctuary...                                            |
                          Ezekiel 9:6
Technical Details
Message-ID: <126@uwmacc.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!topaz!uwvax!uwmacc!dubois
References: <1434@oddjob.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!topaz!uwvax!uwmacc!dubois
From: dubois@uwmacc.UUCP (Paul DuBois)
Newsgroups: net.micro.mac
Subject: Re: problem with regions
Message-ID: <126@uwmacc.UUCP>
Date: Wed, 6-Aug-86 08:40:23 EDT
Article-I.D.: uwmacc.126
Posted: Wed Aug  6 08:40:23 1986
Date-Received: Thu, 7-Aug-86 06:35:54 EDT
References: <1434@oddjob.UUCP>
Distribution: net
Organization: UW-Madison Primate Center
Lines: 33