06-17-2011 01:31 PM
Dear LabVIEW gurus, I have a question that I can't seem to find the answer to on my own.
Here's the background/context:
I have an application with an event loop that checks for keypresses (Key Down? event). For certain keys or combinations, actions are triggered, and the keypress is discarded (i.e. not passed to the front panel). If any control has focus (e.g. the use is entering a number in a numerical control), the keypress is passed to the front panel, and otherwise ignored by my event loop. This basically allows me to define my own keyboard shortcuts, but prevents them from interfering with data entry. I check for key focus on controls using the FindCtrlWithKeyFocus method.
Here's my problem:
If I click on the scale of a waveform chart to change the limits on a graph, FindCtrlWithKeyFocus does not find a control with focus, so my keypresses do not get sent, and I cannot edit the scale. So far, I worked around this by adding other exceptions to the key handling, such as ignoring all 0-9 and "dot/period" keypresses, but it is becoming problematic, because I have key shortcuts for the arrow keys and keypad minus, which I do not want to change. So, I really need to be able to tell somehow when the user might be entering text somewhere (control or graph scale). Is there a way to do it?
Thanks in advance!
06-20-2011 08:03 PM
Hey MNicholas,
There is an event for scale range change. More info here. Hope that helps!
06-21-2011 01:25 PM
@JtotheB wrote:
Hey MNicholas,
There is an event for scale range change. More info here. Hope that helps!
Thanks JtotheB, but I don't think that will quite do what I need. That will trigger and event when the scale range is changed, but not when the user BEGINS editing the scale marker. The problem I'm having is that the user is not able to use certain keys while typing in the new value for the scale (because they normally trigger other key down events). What I need is a way to tell that the user has clicked on the scale bar and is currently typing in a new value. Any idea how I might be able to do that?
Thanks!!
06-23-2011 11:07 AM
Hey Mnicholas,
I've been looking around and asking some of my colleagues about this, and I think the only way to do this might be to register the cursor position of the scale end points and fire events that way. I know that seems like a pain, but there are some examples. Hope that helps!