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: 

What can change my textbox to not a textbox?

I am trying to add a panel to an exsisting project I inhereted. The panel is simply 2 text boxes and a button. I get it working great, then put it in the exsisting project. I then get errors about my text box pointer being a pointer to a char when it is expecting a pointer to an int. I did not change any include files, so what can be changing my textboxes?
0 Kudos
Message 1 of 7
(3,091 Views)
I don't think your text boxes are being changed. Without seeing your code, I would guess that the problem lies in one of the these two things:
1. The declaration of the variable you're using for GetCtrlVal doesn't match the control.
2. The Control ID in GetCtrlVal is wrong.
0 Kudos
Message 2 of 7
(3,091 Views)
The problem with that theroy is that I had this as a seperate program originally and it ran perfect. I simple changed the name of the main function and connected it to a button on the other program. My panel name did not change. It said it was expecting an "int", instead of a "pointer to char". On SetCtrlVal it says it's not a text box.
0 Kudos
Message 3 of 7
(3,091 Views)
What variable was it pointing to when "It said it was expecting an int"? How is that variable declared?

In the SetCtrlVal statement you're having a problem with, try right-clicking on the Control ID (second parameter in SetCtrlVal), then select Find UI Object. Make sure it goes to the control you want.

How did you add your separate program (and panel) to your main program. Do you have two UIR files or one? Did you manually edit the .h file for the UIR? (You should not).

Can you post your code?
0 Kudos
Message 4 of 7
(3,091 Views)
The variable is the variable "value", that comes after the controlID. It is declared as a char[] & I also tried char* to char[].It said it was expecting an "int". The controlID is correct I checked it. The main program has several UIR's, my part only has one. I place a button on thier main panel that activates my panel by simply calling a start_up routine in my code. I did not have to alter thier .h, just mine. I am sorry, I can not post my code. But I did get around this by simply writting my on project seperate from thiers. Thanks for helping.

Rhonda
0 Kudos
Message 5 of 7
(3,091 Views)
Are you ready for more guesses?
It is possible (but very wrong) in a CVI GetCtrlVal call to use the panel handle from one panel and the Control ID from another panel. What runtime error you get depends on the Control ID values assigned by the UIR editor. It is possible to get an Invalid argument type runtime error.
Check your LoadPanel statements to make sure you're using the right panel handle and that you didn't duplicate panel handle variable names.
If you call LoadPanel for your new panel in a function (renamed from main in your separate program) and declare the panel handle variable in that function, that panel handle is local to that function and its value is lost when you return from that function. If you used the same name
as a global, the global variable is unchanged from before you called your new function loading your new panel. That's the variable scope trick of C.
Which .h file did you modify? You should not manually modify the .h file with the same name as your UIR file. The UIR editor takes care of that. The .h file gets rewritten every time you save the UIR file.
Message 6 of 7
(3,091 Views)
Check to see that the control is a textbox and not a numeric of type int. They look the same on the uir if the inc/dec arrows are removed.
0 Kudos
Message 7 of 7
(3,091 Views)