I'm fairly new to wxWindows, and therefore aren't sure if this is a
Python-specific question or not. It sounds like, from the documentation,
the there are a few changes in the Python API for dragging, so I'm
starting the question here. If this isn't right, let me know, and I'll
take this to the wx-users list.
I'm creating a program where there will be several simple graphics that
can be moved around within a box. They aren't being dropped on each
other or anything like that; it's just a scratch area where someone can
rearrange them to get a sense of how they'd look in different
arrangements.
The drop program in the demo area handles highlighting the object being
dropped onto (eg a the King lights up if you drop the Queen on her), and
may also include functionality specific to the non-square-shaped star
and the text. Therefore, it's probably more complicated than I need.
I think I've figured out how to take out the light-when-dropped on code,
and can easily take out the text and masked star. My question is: is
this the way to go to build my simple re-arrange app? Or is a lot of the
code in this example to support the flexibility needed for these
features, and there's a really simple way to handle just moving things
around? Does anyone have an example of a simpler drag-image program?
Second:
I don't want users to be able to drag objects off the side of the
screen. Ideally, I'd really like to limit them to a particular area. It
*looks* like I could do this by adding a wxRect as the final parameter
for BeginDrag, ie:
self.dragImage.BeginDrag(hotspot, self, 0)
becoming:
self.dragImage.BeginDrag(hotspot, self, 0, wxRect(10,10,500,500))
would restrict to a rectangle at (10,10,510,510).
However, this doesn't seem to have any discernable effect. Is this
broken? Or am I misunderstanding the API for BeginDrag?
I have figured that I can put code in the OnLeftUp method to set the
dragShape pos to the min/max x/y values I want, so that at the end of
the dragging period, the object is left at the edge of the screen,
rather than off, but this is only semi-satisfactory: I'd prefer that the
user is preventing from dragging them out of an area at all, rather than
just having them snap back at the end.
Any ideas or answers would be appreciated!
Thanks,
- j.