LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SetCtrlVal on a "string control" is requesting run-time "int" data

Solved!
Go to solution

Hi,

 

We at KPIT Cummins are using LabWindows for one of our automotive projects. We have a GUI with multiple tabs and one of our string text boxes is popping up the below error (also attached jpeg).

 

FATAL RUN-TIME ERROR:   "Temp.c", line 2642, col 38, thread id 0x00000F4C:   Invalid argument type: found 'pointer to char', expected 'int'.

 

We have tried to debug this project and we believe that the line giving us an issue is:

 

ret_val=SetCtrlVal( h_Tab_Intgd[INTGD_CFG_DATA_TAB], INTGDTAB_ACCXSCALE, aa_uc_Temp_Array );

 

where,

 

h_Tab_Intgd[INTGD_CFG_DATA_TAB] is an array of handles for the form (stores all handles for the tabs)

INTGDTAB_ACCXSCALE is the name of the string object (exact constant name as it appears in the LabWindows created .h file for GUI constants)

and aa_uc_Temp_Array is an array of characters. (currently holding "0.000000\n")

 

There is another form in our code that has a similar feature but with a different constant ID...and the SetCtrlVal seems to work for that form. We do not understand why it gives a runtime error for this particular form.

 

This project code is a big chunk of code and we cannot currently share the project due to a confidentiality clause. Can you help us find the exact problem with what little information we have shared ?

 

 

0 Kudos
Message 1 of 6
(4,890 Views)

This is an error that I happen to face sometimes, especially with tab controls; in my experience every time I have eventually found that the panel handle was wrong: may it be that your handle arrays ir rewritten somewere so that it holds incorrect values?

If I were you I'd place a breakpoint where you retrieve the panel handle for the tab page and another on faulting SetCtrlVal line, comparing the panel handles in both places.



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 2 of 6
(4,885 Views)

I would like to request a quick confirmation of my understanding of tab page handles...we have defined an array that indices the tab panes from 0,1,2,...n and all our tab pages are indexed using that very zero based index...hope ive done that right !

 

 

0 Kudos
Message 3 of 6
(4,880 Views)

Hello mowgli,

 

I don't know if I got you right but in my understanding you should not assume tab panel indices but retrieve them using GetPanelHandleFromTabPage.

0 Kudos
Message 4 of 6
(4,875 Views)

Combining both mowgli and Wolfgang, the correct procedure should be:

 

int  i, numPages, handle[...];

GetNumTabPages (panelHandle, PANEL_TAB, &numPages);

for (i = 0; i < numPages; i++) {
   GetPanelHandleFromTabPage (panelHandle, PANEL_TAB, i, &handle[i]);
}

 

 



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 5 of 6
(4,867 Views)
Solution
Accepted by topic author mowgli

Thanks for the code snippet...the error was in the tab page handles...we are grateful for your assistance.

0 Kudos
Message 6 of 6
(4,849 Views)