<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Not a dumb question at all. Hopefully more experienced minds can
give a smarter answer, but one way is to have your rectangles be
separate from gui-elements.<br>
<br>
So you could store your rectangles in a regular old data structure.
Write code to render that to a canvas as needed. When a mouse event
happens on the canvas, query the data structure to find which
rectangle the event happened in.<br>
<br>
I'm not very familiar with Racket's capabilities in this area, but I
would start with the docs on region%<br>
<a class="moz-txt-link-freetext" href="http://docs.racket-lang.org/draw/region_.html">http://docs.racket-lang.org/draw/region_.html</a><br>
<br>
They can be scaled and rotated, and the in-region? function should
let you figure out which region% a mouse event happened in.<br>
<br>
Does that make sense?<br>
<br>
Dave<br>
<br>
<br>
On 04/09/2012 01:20 PM, Nick Shelley wrote:
<blockquote
cite="mid:CAPrQK3AgqyZNFdkQGM96LA5B3BwUxKjPBwZrYjrRvdC_1AonfQ@mail.gmail.com"
type="cite">I don't have much gui programming experience, so sorry
if this is a dumb question.
<div><br>
</div>
<div>I want to draw a bunch of rectangles and sub-rectangles on a
canvas and have something happen when each sub-rectangle is
moused over. I was thinking about just making each sub-rectangle
its own canvas so it can handle the 'enter mouse event, but some
of the rectangles need to be rotated so I don't think that would
work.</div>
<div><br>
</div>
<div>Ideally I want to define each rectangle as it's own entity
with sub-rectangles inside of it that can handle mouse events.
Then I want to be able to translate and rotate that entity (or
place it on the canvas) and have the mouse-handling regions
automatically move with it. However, I don't know of anything
that can both be drawn with a transformation matrix and handle
mouse events at the same time, so I'm wondering what things I
need to put together and how I should combine them to get the
desired behavior.</div>
<div><br>
</div>
<div>Any suggestions would be appreciated. Thanks.</div>
<div><br>
</div>
<div>-Nick</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">____________________
Racket Users list:
<a class="moz-txt-link-freetext" href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a>
</pre>
</blockquote>
</body>
</html>