Article View: comp.windows.interviews
Article #279Re: How do I get mouse ...
From: Steve Sun
Date: Fri, 10 Apr 1992 02:00
Date: Fri, 10 Apr 1992 02:00
71 lines
2227 bytes
2227 bytes
>Date: Thu, 9 Apr 92 13:39:35 MST
>From: adtsp%deneb.aries.saic.com@uunet (Steve Pothier)
>Subject: How do I get mouse sensitivity for a polygon?
>
>
>I want to output some info when the user clicks on one of these drawn
>polygons.
>
>I really just want to be able to attach a handler to a
>GraphicComponent.
>
>Any pointers would be appreciated (even if its just to tell me its
>really is as convoluted as it seems).
>
>Thanks,
>Steve Pothiers
>pothiers@tuva.saic.com
Hello:
What you can do is
1. Subclass a tool (e.g. MyTool) from Tool and
put it in the tool palette of your application.
The CreateManipulator of MyTool will be like:
:
:
newSel = views->ViewIntersecting(e.x-SLOP,
e.y-SLOP, e.x+SLOP, e.y+SLOP);
if (newSel->IsEmpty()) {
s->Clear();
} else {
newSel->First(i);
gv = newSel->GetView(i);
s->Clear();
s->Append(gv);
s->Update();
}
m = gv->CreateManipulator(v, e, rel, this);
delete newSel;
return m;
:
:
2. Modify the CreateManipulator of your
PolygonViews so it recognizes MyTool. For
example,
:
:
else if (tool->IsA(MY_TOOL)) {
//output the info that you want here
}
:
and return back a nil Manipulator so the Viewer won't
execute MyTool's InterpretManipulator.
3. When you run the application, select MyTool
in the tool palette, then click on any PolygonViews
in the viewer. This should output the info that you
specified in PolygonViews' CreateManipulator.
Hope this will help.
Steve Sun
Fujitsu Network Transmission System, Inc.
3099 N. First St.
San Jose, CA 95134
E-mail: steves@hadar.fai.com
Tel: (408)456-7834
Fax: (408)456-7992
Technical Details
Message-ID:
<9204100200.AA23110@hadar.fai.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!ames!agate!stanford.edu!LABREA.STANFORD.EDU!adobe!hadar.fai.com!stevesShow Full Headers
Complete Article Headers
Newsgroups: comp.windows.interviews Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!ames!agate!stanford.edu!LABREA.STANFORD.EDU!adobe!hadar.fai.com!steves From: adobe!hadar.fai.com!steves@LABREA.STANFORD.EDU (Steve Sun) Subject: Re: How do I get mouse ... Message-ID: <9204100200.AA23110@hadar.fai.com> Sender: news@shelby.stanford.edu (USENET News System) Organization: Internet-USENET Gateway at Stanford University Date: Fri, 10 Apr 1992 02:00:03 GMT Lines: 71