From: John C. <j-c...@ra...> - 2004-06-22 12:05:26
|
Ethan Merritt wrote: > On Monday 21 June 2004 06:24 am, John Cerney wrote: > >>I am waiting for mouse input so that mousing is available while the user >>is viewing the plot. For example, if a 3d surface plot is displayed, I >>would do a "pause mouse" so that the users could rotate/scale with plot >>with their mouse. > > > But that's not going to work. If you say "pause mouse" then it will > terminate at the first mouse click (or actually at the first time the > button is released). So you can't do rotate/scale/zoom inside a > pause mouse as it is currently implemented. This is something > that Petr and I were discussing before, but we didn't come to any > particular resolution. > > But you don't need a 'pause mouse' command for this anyhow. > What's wrong with a regular 'pause -1' command? You can still > exit from the pause via a ctrl-C, or a hotkey, or an external trigger. > > Another possibility is to put gnuplot into a loop that goes something > like > load 'loop-until-key' > > where the file 'loop-until-key' contains > pause 1 > if (MOUSE_KEY != <something>) reread I am currently doing something similar, but my 'loop-until-key' file contains: pause mouse if (defined(MOUSE_BUTTON)) \ print "Mouse button Clicked:", MOUSE_BUTTON;\ else \ print "No mouse click?" ;\ exit ;\ reread I do a "pause mouse" (rather than pause 1), because I want to detect a mouse button-3 key event in my main program so I can pop-up a context menu. The only problem with the approach so far is (as we have discussed) if the windows is closed during the "pause mouse", gnuplot hangs. > > Actually I don't think that quite works currently, but it could be made > to work if people decide it's a useful option. > > >> > Wouldn't it be >> > better to program a hot key ("bind <key> '<gnuplot commands>'")? >> > That way the user can either hit the appropriate key or close >> > the window and in either case the response is handled asynchronously. >> >>I could have a hotkey to close the window, but users are so conditioned >>to just close windows when they are done with a window, I don't think >>many would actually use the hotkey. > > > The cvs version should now be able to detect normal window-close > events. > I tried this last night with the latest CVS version and it didn't appear to be working for me. My simple test was this file: set mouse set term x11 splot cos(x)*sin(y) pause mouse if (defined(MOUSE_BUTTON)) \ print "1 Mouse button Clicked:", MOUSE_BUTTON;\ else \ print "No mouse click?" ;\ exit ; print "doing something else"; pause mouse if (defined(MOUSE_BUTTON)) \ print "1 Mouse button Clicked:", MOUSE_BUTTON;\ else \ print "No mouse click?" ;\ exit ; When I run gnuplot with this file, and close the plot window when it shows up, gnuplot still hangs. With the changes you made, I was expecting the close window to break-out of the pause mouse, and set MOUSE_BUTTON to undefined or -1 or something. Does the above file work the same way with you? Thanks, John |