🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.mac
Article #6043

A Rascal/Quickdraw/user problem...

#6043
From: harrow
Date: Thu, 12 Jun 1986 19:44
87 lines
3750 bytes
In my  random  attempts  to  learn  Rascal  and  do  some  useful 
prototyping on the  Mac,  I'm  attempting,  as  part  of  a  user 
interface simulation, to allow the creation of a "map" made up of 
various icons, with those icons interconnected by lines.  So far, 
no problem.

But, I want  the  user  to  be able to "drag" the icons around to 
manually re-position them, so  I  attempted  to experiment with a 
simple oval region and get  use  DragGreyRgn  to  do  the pulling 
around (of the outline)  for  me.    For  this  test,  I  use the 
following  two  code fragments to  generate  (and  remember)  the 
placement of the region, and (in the second segment) to handle the 
mousedown event  to  invoke  DragGreyRgn  and  pull  the  outline 
around.  However, as indicated, I can't even get PtInRgn to agree 
that I did a mousedown IN the oval region!  Hummm.

(Please note that this  is  junky code with a bunch of diagnostic 
things left in...  NOT representative (I hope)).

PROCEDURE DoAddRegion();

VAR
tempRect : RECT;

BEGIN
 
SetPort (FrontWindow());  (*  Make  sure  we're  using  the right 
window *)
OpenRgn();
    SetRect(temprect,20,20,50,70);
    FrameOval(tempRect);
CloseRgn(RegionHandle);
InvalRect(RegionHandle^^.RgnBbox);    (* Force an update *)

END;

.
.
.

(now part of the Event loop...)

    CASE theEvent.What OF

        mouseDown:
            BEGIN
                SetPort (MapWindowPtr);  (* Use our window *)
                GetMouse(@temppoint);
                writeln();
                writestring("From mouseDown...");
                writeint(temppoint.v);
                writeint(temppoint.h);
                writeln();
                writestring("Region's Rect = ");
                writeint(RegionHandle^^.RgnBbox.topLeft.v);
                writestring("  ");
                writeint(RegionHandle^^.RgnBbox.topLeft.h);
                writeln(); 
                writeint(RegionHandle^^.RgnBbox.botRight.v);
                writestring("  ");
                writeint(RegionHandle^^.RgnBbox.botRight.h);
                writeln();
                in := PtInRgn(temppoint, RegionHandle);
                IF  in = TRUE   THEN writestring("in = TRUE")
                                ELSE writestring("in = FALSE");
(* >>> I CAN"T EVEN  GET  THIS TO ACKNOWLEDGE THAT I CLICK IN THE 
REGION <<< *)
                          writeln();
                          writestring("PtInRgn = TRUE...");
                          writeint(temppoint.v);
                          writeint(temppoint.h);
                          junklong := 
                              DragGrayRgn(RegionHandle,temppoint,MapWindowRect,
                              MapWindowRect,INTEGER(NIL),NIL);


Now, all  is  OK  in  that I can CREATE the window and  its  oval 
region where I want them, but I can NOT get the DragGreyRgn to do 
anything (I  expect  it  to  pull  an outline of the oval  region 
around for me, perhaps inappropriately).  As a matter of fact,  I 
can not even get the PtInRgn call to return TRUE when I click the 
mouse directly in the oval region painted on the screen.  What am 
I doing wrong?

Thanks,

Jeff
Technical Details
Message-ID: <3594@decwrl.DEC.COM>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!harrow@exodus.dec.com

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!burl!ulysses!bellcore!decvax!decwrl!harrow@exodus.dec.com
From: harrow@exodus.dec.com
Newsgroups: net.micro.mac
Subject: A Rascal/Quickdraw/user problem...
Message-ID: <3594@decwrl.DEC.COM>
Date: Thu, 12-Jun-86 15:44:58 EDT
Article-I.D.: decwrl.3594
Posted: Thu Jun 12 15:44:58 1986
Date-Received: Tue, 17-Jun-86 05:54:32 EDT
Sender: daemon@decwrl.DEC.COM
Organization: Digital Equipment Corporation
Lines: 87