LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign a founction key to a control?

Dear sir:
Thank you for your answer.I had solved my last problem. Thank your very much!
I'd put some controls in a panel, and I want to associate special key to special control. For example, when a user press "f3", the value of one ring control would be changed.When he press "F4",the value of another ring would be changed.When he press "Enter", a command button would create a commit event. Then what should I do?
0 Kudos
Message 1 of 6
(3,675 Views)
No problems for the command button: in the Edit Command Button panel (double-click on the control in the UIR editor) you will find the 'Shortcut Key' box into which choose a key to associate with the comand button itself. I don't know what happens if the focus is on another control, but it can be tested: the Enter key will trigger the callback of the control with focus or the callback of the control with enter as a shortcut or both?

For ring controls the matter is just a little bit more difficult: you must generate a callback function for the panel and in the EVENT_KEYPRESS case discriminate the key pressed and operate as needed.

Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 6
(3,675 Views)
Dear sir:
Thank you for your answer, thank you very much! But My problem still had not been solved. Because what I want to do is that when a control is inactive, one key press event will active it and change its value.Maybe you want to know why must I do that.Our last version software is under DOS,and our customers had used to those operations, they do not like any varieties.
So I find it is very difficult.
But thank you all the same.
0 Kudos
Message 4 of 6
(3,675 Views)
Ring control do not have short cut like the command buttons do.

One 'cheap' way to do this is to place two other command buttons on the panel and place them out of view (off to the side).

Then set the short cut of these to the function keys that you wish. In the callback function for these hiden command buttons place the code to change the ring control as you wish.

Omar
0 Kudos
Message 3 of 6
(3,675 Views)
Dear sir:
Thank you for your answer, thank you very much! But My problem still had not been solved. Because what I want to do is that when a control is inactive, one key press event will active it and change its value.Maybe you want to know why must I do that.Our last version software is under DOS,and our customers had used to those operations, they do not like any varieties.
So I find it is very difficult.
But thank you all the same.
0 Kudos
Message 5 of 6
(3,675 Views)
The short cuts will work if the control is inactive, but not when the PANEL is inactive (does not have focus).

What you want is a way to make your PANEL come to the front when something else has the focus (another program) by pressing a function key. That is a Window fix and not so much a CVI thing.

One way you might be able to do this is to force your panel to always be on top!
Use a Timer callback.
See the CVI function 'SetActivePanel'

I have attached a short program that does what I think you are wishing to do. You will need to

Omar
0 Kudos
Message 6 of 6
(3,675 Views)