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

Reply via email to