Niels Menke wrote: > I didn't really get a self contained example to work in reasonable time, > so i'm sending your our current workspace class (where the things we > discussed happen, line 450 and following) and the main class. > I hope this is enough to take an educated guess on how i could get the > desired behaviour of scrolling when the right mouse button is pressed.
yow -- all this time, I didn't notice that you were saying RIGHT mouse button -- thus you can't just use the existing Move GUI Mode, which moves with the left button. However, you should be able to re-use that code, you just need to change the mouse button it is bound to. > I am not sending this to the mailing list yet because i dont want to > spam it with that much text. Don't worry about it, text is small, and others may have helpful suggestions. With a quick look at your code, it looks like you are repeating a LOT of stuff that's built in to FloatCanvas -- I guess that's what happens when there are few docs. However, do keep in mind that the whole point of FloatCanvas is to make drawing and interacting with objects in arbitrary coordinates easy -- if you're doing coordinate transforms from pixels to your coords yourself, you're doing too much work. On to the problem at hand: The idea behind GUIModes is that it provides one place for you to specify everything that happens with mouse events. Many applications have multiple modes, where different things happen, and this makes it easy to encapsulate each mode as an independent class, rather than a bunch of "if mode==something" statements. For your purposes, take a look at the GUIMode.GUIMove class. You essentially want to make a class just like that, but with "left" changed to "right" everywhere. Also you'll want to put in whatever else you want for the other mouse events. The easiest way to accomplish that is copying and pasting the code, then editing it. That will result in a bunch of code duplication, which is a non-no, so it would be great if you could think about ways to put the common code in one place for both modes to share, but if you don't do that, hopefully I will get a chance to. As for small samples, start by grabbing one of the simplest ones in the Demos DIR, and play with your new GUI Mode there. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] _______________________________________________ FloatCanvas mailing list [email protected] http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
