Change mouse cursor over graph cursor.

Is there a way to change the mouse cursor as it moves over graph cursors when using trackmode TrackDragCursor? To indicate that you can position the cursor.

You could accomplish this with the graph's CursorMouseMove event. For example, create a new project with the NI Measurement Studio AppWizard and follow these steps:
Add a graph to the dialog. Right-click on the graph in the dialog editor, click "Class Wizard ...", click the Member Variables tab and add a member variable for the graph called m_graph. Click OK.
Right-click on the graph in the dialog editor and click on "Events ...". Add an event handler for CursorMouseMove called OnCursorMouseMove and add an event handler for PlotAreaMouseMove called OnPlotAreaMouseMove. Click OK.
Go to the header file for your dialog class and add this to the bottom of the class declaration:
private:
bool m_cursorChanged;
HCURSOR m_defaultCursor;
HCURSOR m_crossCursor;
Go to the source file for your dialog class and add this to the end of the
OnInitDialog method:
m_graph.TrackMode = CNiGraph::TrackAllEvents;
m_graph.Cursors.Add();
m_cursorChanged = false;
m_defaultCursor = ::LoadCursor(NULL, IDC_ARROW);
m_crossCursor = ::LoadCursor(NULL, IDC_CROSS);
Add this to your CursorMouseMove event hander:
if (!m_cursorChanged)
:etCursor(m_crossCursor);
m_cursorChanged = false;
Add this to your PlotAreaMouseMove event handler:
if (m_cursorChanged)
:etCursor(m_defaultCursor);
m_cursorChanged = true;
Run the application. You should see that the mouse cursor changes to a cross when you mouse over the cursor.
Hope this helps.
- Elton

Similar Messages

  • Unexpected Windows cursor/Waveform Graph cursor behavior

    Hi,
    I got a very strange Windows cursor behavior with waveform graph. Simplified VI is attached.
    LabVIEW 2014 SP1
    The problem is:
    The VI contains only one waveform graph.
    1. I start the VI. Cursor Movement Tool is selected in the Graph Palette by default. Corresponding “Cross with dot” Windows cursor appears when mouse is moved over the plot area (see image). So far so good.
    2. I select Zoom in the Graph Palette and use it two-five times (second image).
    3. I select Cursor Movement Tool in the Graph Palette again but Windows cursor does not change as it should. It is an open cross now (third image); i.e. the same as shall appear when cross of Graph Cursor Lines is reached.
    4. I click mouse three-seven times anywhere in the plot area and the cursor becomes normal (as in the first image).
    The problem is not only in shape of the Windows cursor. The whole Graph cursor functionality does not work properly if the Windows cursor has the wrong shape.
    Please advise what could cause this problem.

    It seems, i cannot explain the question in good way
    It is not about my data or zooming. It is about strange bahaviour of the Graph. The following sequence of steps illustrates the problem and shows that the zooming is not the issue (or, at least, not the main issue):
    I do the following:
    1. Start the VI.
    2. Select first Graph cursor in Corsor palette and use pop-up menu "Bring to Center".
    3. Zoom couple of times (not too much) keeping the Grapg cursor visible.
    4. Select Cursor Movement Tool in the Graph Palette.
    5. "Open cross" Windows cursor appears from the beginning. I cannot pick up the Graph cursor.
    6. Click left button of the mouse several times in any poin of the graph area.
    7. Windows cursor is changed to the normal "cross with central point".
    8 Now I can pick up the Graph cursor.
    I would suspect problems with zoom until p.5. However p.6-8 are done without any change of the zoom.
    By the way, I found more:
    If I try to move the Graph cursor after p.5, the whole graph moves and fires event "Scale Range Change". It must not happen with Cursor Movement Tool selected.
    I can guess only about some strange setting of the graph. May be I am not aware about them

  • Change mouse pointer over selected text

    I have a JTextArea and i want to change the default mouse pointer to the arrow pointer when the user points to a selected text. Just like the way JCreator works.!
    Thanx

    Try this :
    Cursor textCursor = new Cursor(Cursor.TEXT_CURSOR);
    Cursor arrowCursor = new Cursor(Cursor.DEFAULT_CURSOR );
    textArea.setCursor(textCursor);
    textArea.addMouseMotionListener(new MouseMotionAdapter() {
         public void mouseMoved(MouseEvent e) {
              int location = textArea.viewToModel(e.getPoint());
              if (textArea.getSelectionStart()<=location && location<textArea.getSelectionEnd()) {
                   if (textArea.getCursor() != arrowCursor) {
                        textArea.setCursor(arrowCursor);
              else {
                   if (textArea.getCursor()==arrowCursor) {
                        textArea.setCursor(textCursor);
    });I hope this helps,
    Denis

  • Programmatically fire graph cursor move event

    Is it possible to programmatically fire the Graph Cursor Move Event ?  Assigning a value to the Cursor Index or Cursor Position property node does not seem to do it.
    Solved!
    Go to Solution.

    The graph cursor move event contains processing code for data on the graph along with front panel display of those results.  Data is put onto the graph during data acquisition which occurs in another event.  When that data acquisition event finishes I need to cause the processing code to execute once to update the front panel display so its results are shown for the new acquired data.
    I could put the processing code into a different event that fires on say a button value change.  Then the graph cursor move event would fire that button event change by setting its value change property.  The data acquisition event could also fire that button event.

  • How do I get an event-based response to a graph cursor change?

    I want to respond to the user moving a cursor on a data (X-Y) graph. (LV 7.0)
    What I really want is an event called "Graph.Cursor.Value Change", which would supply me with the new coordinates, but I see no such event.
    If I use the MOUSE MOVE event to trigger obtaining the cursor values, it does not give me an event, until the cursor has stopped moving, the button is up, and the mouse moves off the cursor line.
    Sure, I could use a TIMEOUT event, and read it every 100 mSec, but I don't like the time lag.
    What I did was to set a flag TRUE on Graph.MouseDown and FALSE on Graph.MouseUp. I then choose an event timeout of 10 mSec or -1, depending on that flag.
    That works, but is there a more direct way that I'm missing?
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

    No, unfortunately there is not.
    To code around this limitation, I typically use the timeout event in a more complex way as follows:
    The timeout is wired to a shift register that is initialized with "-1" (no timeout). The value from the shift register then crosses the event structure and feeds to the shift register on the right in almost all event cases.
    I add two special event cases:
    (1) "graph-mouse down" puts a small number (e.g. 10ms) in the right timeout shift register
    (2) "graph-mouse up" puts again a -1 in the right timeout shift register
    (x) All other event cases (incl. timeout) wire the current timeout straight across to the right shift register.
    The timeout event contains the logic to read the graph cursors and associated actions.
    This way there is normally infinite timeout. Once the mouse goes down on the graph, the timeout executes at relatively rapid succession until the mouse is raised again. At which point everything quiets down.
    LabVIEW Champion . Do more with less code and in less time .

  • Moving xy graph cursor with mouse and programmab​ly controllin​g snap to point

    Hi,
    I have run into a bit of a problem. I am trying to create a program which allows a user to select a location on an XY graph by simply clicking in the vacinity of the plot. Most of it is working, however I find that I can't programmably control the snap to point function reliably.
    I hope this is a clear outline of the problem:
    - The cursor starts in a Free state, so that when the
    user clicks in the plot area, I can set the cursor
    position to the nearest point by setting the
    CursorPosition using the graph's property node.
    - Maybe the user didn't like the chosen location and
    wants to drag the cursor over a bit. Ok, user drags
    the cursor to a new position.
    - Now th
    e cursor position is probably not exactly on
    the plot trace. If, at this point, I set the cursor
    to Snap To Point, the cursor does not snap to the
    nearest point on the graph (relative to its current
    position), but instead to the last place a _mouse_
    action placed it.
    - Immediately after the new location has been set,
    the cursor state has to be reset to free in case I
    need to programmably move the cursor again (I
    can't seem to programmably control the mouse in
    any state but Free)
    How do I go about getting the cursor to snap to the closest point at it's new location? I'm at a loss.
    Any insight you might have would be greatly appreciated.
    Thanks much!
    Tere

    So what is the question about... I have to use XY graph in my program. It is used in Loop while cycle. It shows the statistic of a variable. I am using cursors in this graph to check the actual value of a variable in different period of time. But there are 7 variables and it is extremely hard for user to check each value independently. So I tried to make them moving on the X axis (TIME) together using the property node (cursors reading the position (only X axis, Y axis status lock to plot) of the major cursor and follow it... Everything looks great? But it did not work when I am trying to move the major cursor manually on graph... It works only when I am using the cursor movement buttons... But they work very slowly when there is a lot of data in graph.
    I want to find out is it possible to make seven coursers mouthing together By the X axe and be Locked each at its plot by Y axe manually (Using mouse moving on a graph). Is it possible? If it is than how to do it?

  • Changing the table header's cursor on roll over

    Hi,
    I would like to change the cursor when the user rolls the mouse pointer over the table header.
    I have tried with header.setCursor(new Cursor(Cursor.HAND_CURSOR)); but it didn't work out.
    Thanks.

    Hi, problem is causing this method in BasicTableHeaderUI:
    public void mouseMoved(MouseEvent e) {
    &nbsp&nbspif (canResize(getResizingColumn(e.getPoint()))) {
    &nbsp&nbsp&nbsp&nbspsetCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
    &nbsp&nbsp} else {
    &nbsp&nbsp&nbsp&nbspsetCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    &nbsp&nbsp}

  • Change mouse cursor in applet

    Is it possible to change mouse cursor, from the arrow into an icon, when the mouse cursor is over an applet in browser?

    spekulanten wrote:
    Is it possible to change mouse cursor, from the arrow into an icon, when the mouse cursor is over an applet in browser?Have you tried it? (I think it requires the applet to have focus)

  • Change Mouse Cursor with JTabbedPane

    Case:
    I have a JTabbedPane with many tabs
    Need:
    i want to change the mouse cursor when i want to select one of my tabs
    Problem:
    I want to know how i add this mouse event on the tab only not to whole tabbedpane
    Thanks,

    I don't think that you need events at all. If you have a JPanel that is your tab, the just do.......
    panel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    Then whenever the mouse is over that panel, you will have the cursor that was defined. You can set the cursor on an Component.

  • Hand cursor not displayed when mouse is over JEditorPane hyperlinks in 1.5

    Java version 1.5 does not show a hand cursor when the user mouses over a hyperlink within a JEditorPane, which it did in version 1.4.x.
    Create a new JEditorPane. Then set the content type (setContentType) as "text/html". Then use setText to add an html hyperlink. When the user mouses over the hyperlink, the cursor remains a pointer cursor. The cursor used to change into a hand cursor symbolizing a hyperlink.
    p.s.) The hyperlink still works, the cursor just doesn't change.
    Has anyone noticed this? Has it been reported as a bug? Is there a workaround?
    Thanks for any/all help!

    I have the same problem which I cannot seem to solve. I have a JEditorPane in a JDialog, not a JFrame, and I do not get a Hand cursor over the link. If I use a JFrame, I get the hand cursor.
    Any ideas? I tried with setting the cursor by hand using
    pane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); in the ENTERED-part of a slightly more advanced hyperlink listener (gets pane in constructor). But that did not help either.
    Here is the code. Check out the difference between JDialog and JFrame.
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.awt.*;
    public class HyperLink extends JDialog
         public static void main(String[] args)
              HyperLink h = new HyperLink();
              h.setVisible(true);
         public HyperLink()
              Container cp = getContentPane();
              JEditorPane p = new JEditorPane("text/html",
                                  "<html><body><a href='http://www.google.com'>Google</a></body></html>");
              p.addHyperlinkListener(new HyperlinkListener() {
                   public void hyperlinkUpdate(final HyperlinkEvent he) {
                       HyperlinkEvent.EventType type = he.getEventType();
                       if (type == HyperlinkEvent.EventType.ENTERED) {
                        System.err.println("entered");
                       else if (type == HyperlinkEvent.EventType.EXITED) {
                        System.err.println("Exited");
                       else if (type == HyperlinkEvent.EventType.ACTIVATED) {
                        System.err.println("Now going to " + he.getURL());
              p.setEditable(false);
              cp.add( p );
              pack();
    }

  • XY Graph Cursor - Changing its style

    Hi,
    Is there a way to change the style of the cursor at the xy graph to an icon that I made?
    Regards.

    Hi,
    Here follows a link with informations abou XControl and how o create it.
    http://www.ni.com/white-paper/3198/en/
    Thiago Matos
    Engenharia de Aplicações
    National Instruments Brasil

  • Why does the graph cursor (snap mode) snap to unvisible curves? How can i change that?

    I display several curves in one graph. To get a better overview the user can filter unwanted curves by setting the attibute to unvisible. There is one cursor switched on in the graph with the option "snap to plot". The user can move the cursor and read the coordinates and curvename. Unfortunately the cursor snaps also to the unvisible curves. How can I block that behaviour? The cursor should only jump on the visible curves.

    > with the property Cursor.Plot I can set or get the current plot number
    > of the cursor, but I cannot prevent the user to move the cursor to an
    > unvisible plot. Labview allows the cursor to be moved to a curve witch
    > is unvisible in the graph. I want the user only to be allowed to jump
    > betwen the visible curves.
    >
    The graph cursors can be locked to a particular plot or set to snap to
    any plot/point on the screen. You cannot see invisible plots, and you
    probably can't see black plots on a black background, but the graph
    intentionally lets you place cursors there and other users wouldn't be
    happy if it changed.
    What we will likely add at some point is a way to truly show and hide a
    plot. In the meantime, you can also just change w
    hat is plotted.
    Hidden plots can be removed, no points, and the cursors will not go there.
    Greg McKaskle

  • Changing Mouse Cursor with a Thread

    Hi all
    I am trying to change mouse cursor inside a thread for a graphical program so that the GUI does not freeze while new image is calculated and shown on the main frame. I have the below code. It works altough not the way it should. Forexample, when I press accelarator keys to show an image (ctrl+D) I see strange characeters on the frame and they disappear when the image is shown. Also I use scroll pane to show the images but when I use this thread it does not display scroll bars when the image does not fit into the viewing area (a panel). If I don't use this thread scroll bars apeear as they should. I could not find what is causing these strange behaviours. Also after image calculaed and shown on the screen, the thread should be terminated, right? But how? I could not find exact info on this. Any ideas on these? Thanks.
    pp = new PixelPanel();
    jsp.setViewportView(pp);
    pp.addMouseMotionListener(this);
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    thread1 = null;
    thread1 = new Thread("thread1")
    public synchronized void run()
    try
    pp.showGrayImage();
    finally
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    thread1.start();

    I am trying to change mouse cursor inside a thread
    for a graphical program so that the GUI does not
    freeze while new image is calculated and shown on the
    main frame.What does the mouse cursor have to do with your lack of multithreading and you doing all the work in the AWT thread?
    I have the below code. It works altough
    not the way it should. Forexample, when I press
    accelarator keys to show an image (ctrl+D) I see
    strange characeters on the frame and they disappear
    when the image is shown.Probably because it can't repaint because you're hogging it with painting work.
    Also I use scroll pane to
    show the images but when I use this thread it does
    not display scroll bars when the image does not fit
    into the viewing area (a panel). If I don't use this
    thread scroll bars apeear as they should. I could not
    find what is causing these strange behaviours.Probably because it can't repaint because you're hogging it with painting work.
    Also
    after image calculaed and shown on the screen, the
    thread should be terminated, right? But how? I could
    not find exact info on this. Any ideas on these?A thread executes its run method and just stops when it's done.

  • Problem with i-Planet and change mouse cursor

    Hello, I know how change mouse cursor using Toolkit.getdefaultToolkit().createCustomCursor(Imagen,new Point(0,0),String) and setCursor. It works in a local applet but it doesn`t in my aplication. This aplication attach a i-Planet web server and displays the following error:
    java.lang.NoSuchMethodError: java/awt/Toolkit: method createCustomCursor(Ljava/awt/Image;Ljava/awt/Point;Ljava/lang/String;)Ljava/awt/Cursor; not found
    Where's the problem? Maybe an incorrect jdk version. I don�t think so because I use 1.3.1 version and this method works since 1.2 version.
    Thank you for all.

    hi,
    iplanet has its own jar files in \Netscape\Server4\bin\https which contains the same jar files as it is in jdk dir...so importing ur jar files thru the environment might create a similar problem

  • Unknown graph cursor tool

    I'm hoping someone can identify a graph "tool" that's interfering with my LabVIEW program.  It's not on the normal graph palette and I can't find reference to it anywhere.  It activates seemingly on its own during runtime, and sticks around if I abort execution (its behavior appears to be coded into the graph itself).  I wasn't able to take a good screenshot of what the pointer looks like when the tool is active, so I've included a scaled-up drawing below (pointer is the black/white parts).
    Some additional details:
    - It usually activates when the mouse point hovers over one of the cursors on my XY graph (but only under certain conditions that are not 100% reproducible).  The graph cursors are free dragging, and the tool has only activated when I had more than 1 plot on the XY graph.
    - If I click on a graph cursor when this tool is active and drag in either the +/- Y direction, the Y scale min/max values change to seemingly random values and the Y scale begins scrolling up.  Nothing happens if I move the cursor in purely the +/- X direction.
    Much thanks in advance.

    Okay, I've been able to reproduce the problem consistently in a much simpler VI (attached).  It only contains is a single XY graph, with no code on the block diagram.  There's some data saved on the graph, and I put a bunch of cursors on it.  When I follow the steps below, I've been able to reproduce the issue 100% of the time.
    I should note that I'm using LabVIEW 2014 Professional (64 bit) on Windows 7.
    Attachments:
    Test.vi ‏118 KB

Maybe you are looking for

  • Issue with Anlytical Functions,Ref Cusor and Bulk Collect

    Hi All pls go through the following code declare type salt is table of emp.sal%type index by binary_integer; st salt; type refc is ref cursor; rc refc; begin open rc for 'select max(sal) over (Partition by deptno) as Sal from emp'; fetch rc bulk coll

  • Paying for Skype subscription w/ PayPal

    I want to join skype for international calls using PayPal.  I know I have at least $500 credit on PayPal, why does Skype insist I enter a credit card number (again) when I am simply paying with my existing PayPal credit?  Dumb.  Why would you ask for

  • SQL Loader error number 1 in OWB 9.0.4

    I'm trying to execute a flat-file to database table mapping (using SQL*Loader), having set up my locations & connectors. When I execute the mapping, I get the following message: Starting Execution COM_COM_MT_STG Starting Task COM_COM_MT_STG RPE-1013-

  • Can't perceive what's wrong with SELECT.

    Hello, I've executed this select - select * from tax.tax_payer@reis tp left outer join re_right@reis r on (tp.tin = r.tin or tp.tin = r.tin_a1 or tp.tin = r.tin_a2) where (r.right_status = -1 or r.right_status is null) --and r.right_id is not null an

  • EA6500 NAT Redirection Bug???

    I have a pair EA4500s that I am swapping out for a pair of EA6500s.  One EA6500 is a router.  The 2nd EA6500 is set as a bridge and us being used as an Access Point about 200ft and two floors above the main EA6500 router.  The two units are connected