LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

KeyFocus on Graph?

Hi,
 
I would like to be able to set the KeyFocus to an XY graph so that I can capture KeyDown and KeyRepeat events from it in order to do various things (like move the cursors).  But it seems impossible to give the graph KeyFocus -- if I set it to true and then read it right afterwards it returns false (see attached VI).
 
I know that the graph is composed of lots of other parts, so it might make sense to assign focus to one of them (like the cluster of buttons for cursor control).  But I don't see any easy way of getting a reference to them to assign them key focus.  Besides, I'd like to generically have this work even without the cursor palette showing. 
 
The only thing I could think to do was to make some other object and assign it KeyFocus, but this seems like a ridiculous work around.  Any other ideas?
 
Thanks in advance,
Eric
 
0 Kudos
Message 1 of 5
(2,774 Views)

The reason the graph can't be given key focus is that it's an indicators and outputs (by definition) can't have key focus--how would you type into an output? Logically, where would the text go?

Having said that there is certainly a way to get the interface built that you are envisioning. How is it exactly that you see the interface working?

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 5
(2,763 Views)
> outputs (by definition) can't have key focus
 
OK, I guess I should have realized that.  Except that it would be nice, for example, to be able to put focus on a string indicator so that you could copy text out of it using ctrl-C.  Or in my case, for a graph, which although the graph itself is an indicator is clearly composed of a lot of pieces that are controls.  My thought was that you would click on the graph and then you could move the cursors with the arrow keys (maybe toggle between the cursors using the tab or spacebar or something like that).  So, if its a control vs. indicator issue, is it possible to get a reference to the cursor motion control cluster, for example?  Then I could just give it the key focus and handle key events from it.
 
Thanks,
Eric
 
0 Kudos
Message 3 of 5
(2,755 Views)
From your description I would say that a lot of the functionality you want is alreafy there. You can't do control-C but by right clicking on the graph you can copy the data out of it (assuming the VI is setup properly). And you can manually create cursors and drag them around--or use key down events to programatically move the cursors..
 
Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 5
(2,749 Views)
You don't have to add a control. You can use the Mouse Down on the graph to set a flag and then Key Down on the VI (if the flag is true) to run your code. The only problem with this is if you want the key down event for something else, but then you can basically just stick it in the F case. You would also need to reset the flag.

___________________
Try to take over the world!
0 Kudos
Message 5 of 5
(2,748 Views)