Hi phil, Thanks you to waste time on my problem.
I have try something like this void FenetreCourbe::OnLeftDown(wxMouseEvent& event) { PLGraphicsIn g; wxPLplotstream* pls = GetStream(); // pls->adv(0); uncomment this line does not change result g.dX = event.GetX(); g.dY = event.GetY(); g.subwindow=0; plTranslateCursor(&g); } g.wx, g.wy are always 0 I have used this http://plplot.sourcearchive.com/documentation/5.9.9-1/plpage_8c_aee8b46bbe61887f2fd8dec90a7338e0d.html#aee8b46bbe61887f2fd8dec90a7338e0d. I do not understand why I must give g.dX, g.dy and not g.pX and g.pY All others fields of PLGraphics structure are unitialized Le 20/12/2015 13:07, Phil Rosenberg a écrit : > Hi Laurent > (Alan, please see my email below - I accidentally replied to Laurent > instead of replying to all yesterday) > > I've just had a look and you can use plTranslateCursor to get the > coordinates. This function is listed as part of the API on p181 of the > documentation, but it doesn't seem to be documented anywhere. > > This function isn't exposed in the C++ interface, so therefore isn't > exposed by the wxWidgets interface. Hence I am not sure how you can > access it unless you are using the C interface. > > Alan - I have just written some code to expose plTranslateCursor in > the C++ interface and have added some code to the wxWidgets binding to > capture mouse events and pass them back to the user easily. > > Are you happy for me to commit these changes? > > On 19 December 2015 at 21:46, Phil Rosenberg <p.d.rosenb...@gmail.com> wrote: >> Hi Laurent >> >> It looks to me like you are writing a wxWidgets application yourself. >> Is this correct? Unfortunately plGetCursor only works when you do not >> provide your own wxDC to Plplot, in this case plplot uses wxPlViewer - >> a separate wxWidgets executable which captures the mouse clicks and >> reports them back to the library. It is wxPlViewer that is used when >> you run the examples from the command line. >> >> If you are passing a wxDC into Plplot, plGetCursor doesn't work and >> emits a warning, but you probably don't see the warning as it is sent >> to stdout. In this case you must handle mouse events yourself and >> plGetCursor will not work. You need something like >> >> void wxPlFrame::OnMouse( wxMouseEvent &event ) >> >> { >> >> if(!event.ButtonDown()) >> return; >> //get the mouse position >> wxPoint cursorPosition = event.GetPosition(); >> >> //some code to convert to plot coordinate >> } >> >> Bind this function using the wxWidgets Bind() function or and event >> table. Unfortunately the last bit, converting to plot coordinates you >> may have to do yourself. I do not think there is a built in function >> to do it - Alan, please correct me if this is wrong. However, if in >> your wxWindow you remember the parameters passed into plwind then you >> should be able to calculate the plot coordinates from the pixel values >> returned from GetPosition(). ------------------------------------------------------------------------------ _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel