Thu 23 Apr 2015 03:41:37 PM UTC, comment #12:
Thanks for testing. They are doing what I expected. I checked in a fix for FLTK here (http://hg.savannah.gnu.org/hgweb/octave/rev/144498565de9). Closing report.
|
Thu 23 Apr 2015 12:03:03 PM UTC, comment #11:
BTW, ginput does move currentpoint.
Clicking lower left:
and then, moving mouse cursor to upper right and...:
Is this enough info?
|
Thu 23 Apr 2015 10:26:30 AM UTC, comment #10:
(added comment)
I can see that the focus is on the graphics window when I type the key because I have "focus follows mouse" set in one of those UI tweak utilities for Windows and the graphics title bar indicates focus.
|
Thu 23 Apr 2015 10:24:23 AM UTC, comment #9:
Rik,
The secondaction (type "a") gives me an error message in the terminal:
Apparently Matlab transfers the focus to the terminal for key presses even if the mouse cursor is in the graphics windows.
The currentpoint for the entire action sequence remains to be the same and it is two rather than one for reasons unknown to me:
|
Tue 21 Apr 2015 08:53:59 PM UTC, comment #8:
I think I need another test run. I know that Matlab updates the currentpoint property when ginput is run. Does it update the currentpoint property for every keypress regardless of whether ginput is running?
Sample code:
Is the answer (1,1) or (10,10)?
|
Tue 21 Apr 2015 07:38:50 PM UTC, comment #7:
Thank you very much for the fix!
I'll try later tonight, or tomorrow.
|
Tue 21 Apr 2015 03:52:13 AM UTC, comment #6:
I fixed the return coordinates for Qt in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/248f2f2e7d48). It was more difficult than I had hoped.
I'm re-titling to reflect that FLTK has not been updated
|
Sun 19 Apr 2015 03:29:07 AM UTC, comment #5:
Thanks Guillaume. I now have enough information to code a solution.
|
Sat 18 Apr 2015 11:30:58 PM UTC, comment #4:
Here is what MATLAB returns:
|
Sat 18 Apr 2015 10:43:17 PM UTC, comment #3:
@Philip: Could you test whether Matlab is updating the CurrentPoint property when a key is pressed?
Sample code:
You said that the value returned in (x,y) was correct for a keypress. Was the value of the CurrentPoint property the same as that returned in (x,y) which is something like (5,5)?
|
Tue 14 Apr 2015 07:44:27 PM UTC, comment #2:
I just tested on Linux -> same issue -> OS set to Any
|
Tue 14 Apr 2015 07:18:12 PM UTC, comment #1:
Confirmed. Although what it appears to do is simply return the coordinates of the last mouse button press (maybe initialized to 0,0 if there has bee no mouse button yet).
This will have to be fixed separatel for the FLTK toolkit and for the Qt toolkit.
For the FLTK toolkit the file is libinterp/dldfcn/__init_fltk__.cc. The function is handle() and the case statement block is FL_KEYDOWN. Probably need to borrow the code from FL_PUSH (single mouse click) and set the currentpoint property of the axis.
This is what the callback for a keypress in ginput.m relies on to get the positioning.
Of course, this might not be exactly Matlab compatible as my reading of the documentation suggests that only a true mouse click should set the currentpoint property. But, maybe this small Matlab incompatibity isn't as bad as not returning X,Y coordinates.
For Qt, the file to change is libgui/graphics/Canvas.cc. The function is Canvas::canvasKeyPressEvent. Very likely the same solution in that updateCurrentPoint (figObj, obj, event) needs to be called when a key is pressed, not just for a mouse event.
|
Tue 14 Apr 2015 12:49:33 PM UTC, original submission:
With the OpenGL toolkits, ginput returns (0, 0) for the XY coordinates when a key is pressed. This has been the case since 3.8.2
In gnuplot has been working fine since at least 3.8.2. Matlab's ginput also returns proper plot coordinates for key presses
|