From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

cannot get value from numeric field and show it on the other

i'm trying to get the value enter in numeric field by user .after user pressed the button it will do so calculation and place the ans into another another numeric field. perhap you can send me ur file that do this:
1)take the value from one numeric field ( "amplitude of positive" as in .uir file)
2)user pressed the buttton(_ok button)
3)the value enter by user is being multiply by 3(this is just a calcluation process,can do other process)
4)the final answer is inserted into the other numeric field ( "amplitude of negative" as in .uir file)
0 Kudos
Message 1 of 5
(2,750 Views)
Try the following steps.
1. You need to generate a callback for the OK button. In the UI editor, right-click on your OK button, then select Generate Control Callback.
2. In the OK callback, under the EVENT_COMMIT case, read the value of "amplitude of positive" using GetCtrlVal(), then do your calculation and write the new value to "amplitude of negative" using SetCtrlVal(). To use the function panels of these functions, type GetCtrlVal (in your OK callback), then press Ctrl-P. Right-click on any parameter to get some help.
3. If "amplitude of negative" will always be updated by the program and not by the user, change the control to an Indicator. In the UI editor, double-click on the "amplitude of negative" control, and change the Control Mode from Hot to Indicator.

It sounds like you would benefit from working through the tutorial and looking at some of the sample projects the ship with CVI. From any CVI window, goto Help >> Contents >> Contents and browse the topics under Using LabWindows/CVI.
Welcome to CVI!
0 Kudos
Message 2 of 5
(2,750 Views)
i got try to do the tutorial in the disk. i got this error:
<< Library function error (return value == -4 [0xfffffffc]).
Panel, pop-up, or menu bar handle is invalid>>>
when i try to run function panel in the user interface library. i had use a lot of name for my Panel Handle(such as handle, panel_Handle...),Control ID (such as PANEL_AMP), and value as "&", but none of try can get rid of this error!!!
0 Kudos
Message 3 of 5
(2,750 Views)
Your program missed a callback function for the OK button which I created and than I used GetCtrlVal and SetCtrlVal function from CVI Userinterface library to get and set the values on the numeric controls. If you only want to display a numeric value in a field (not being able to edit it) than set this control to "Indicator" by using the UI Editor.
Please see also my comments in your program which I added as zip files again. The only thing you have to do is to add this files to a new project file.
Regards,
Heinrich Illig
National Instruments
0 Kudos
Message 4 of 5
(2,750 Views)
What sample were you working on when you got those errors? Did you look at the solution for that sample? The solutions ship with CVI and are in the ...\CVI\tutorial\solution directory.
0 Kudos
Message 5 of 5
(2,750 Views)