LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CONTROL MODE

Hi,
  I have a panel in my uir. in which i have ring slides and numeric controls. now they are on the configure panel and they need to be updated everytime the user enters his selection. Which is the best control mode to use on the numeric control (hot,normal). I m a bit confused i tried using normal for read timeout(numeric) but then at times it does not timeout at the desired time. The problem is that if i select 10000ms at one time it would work fine then. if i run the program again and i select 500 ms it would still timeout in 10000 ms.
anything that u can suggest
thanking u in advance
kunal
 
0 Kudos
Message 1 of 3
(4,180 Views)

Hello,

from your request it is difficult to determine if your problem is related to control mode. You say that user must "enter his selection". So maybe you have a "start" button. If yes, in the callback related to "start" button you must simply load the timeout value actually present in the UIR by calling "GetCtrlVal" function.

If you want your program start acquisition when a new value is stored in the timeout control, you have to select the control mode as "hot" and associate to the control a callback.

Your callback will be something like this:

int CVICALLBACK panelCB (int panel, int event, void *callbackData,int eventData1, int eventData2){
    if (event == EVENT_COMMIT){
     GetCtrlVal(panel,control, &timeoutValue); // get new timeout value
     // continue...

About events generated: in the UIR press the "Operate Tool" button (the hand with red and green dot in upper right corner). Clicking on controls, you can see in upper left corner the events generated. If you change a control from "Hot" to "Normal" you can see the difference...

Hope this help

baloss

0 Kudos
Message 2 of 3
(4,170 Views)

Let's suppose your application is structured this way:

There is a timed task running based on some general parameters like the timeout value you used as an example. You want to permit the operator to change this value without disturbing the running process: for this reason you display the actual timeout value and you want that he can modify this value.

The control mode affects the events that are generated by the control, particularly, the HOT mode permits the control to generate COMMIT events, wether in normal mode these events are never generated by user action on the control. In a situaztion like the one described above, you can configure the control as HOT and react only at commit events on it (but the commit must be triggered by the user for example pressing Enter key after the correct value is input) or you could set the control as NORMAL and menage the VAL_CHANGED event on the control. In this last case, supposing the operator wants to input a value of "500", the callback will be triggered three times, with values of "5", "50" and "500": in this can be not so easy to determine which is the effective value the operator wants to input (what if "500" is only a step to "5000"?)

In such a situation, I normally prefere to display more controls: an indicator with the actual timeout value, a control for the new timeout value and an "Apply" button that when pressed handles the change in the settings: the numeric control must not have any callback installed and the button callback reads the numeric value, insert the new parameter in the process and finally displays the value in the indicator.

I hope this suggestions can help you.



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?
Message 3 of 3
(4,165 Views)