LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

access panel controls from module

I'm attempting to split my code up into modules to keep things organized. The mainpanel.c file contains the UI control callbacks and calls into my DAQHardware.c file which loads the DAQmx tasks, sets up events for data, processes the data, and the part I'm having problems with: sending data back to the UI.

 

I found this reply by mvr which sounds exactly like what I'm trying to do but my brain isn't cooperating with the implementation details. It seems like the first and last suggestions are the most appropriate for me since I'm pushing data from the DAQ rather than pulling it. If I add a display update function (UpdateCounter in his example) to mainpanel.c, where would I include its declaration/prototype so DAQHardware.c can find it? mainpanel.h is autogenerated by the .uir file and says it should not be edited, does it make sense to just create a brand new include file for these update functions and include it from both mainpanel.c and DAQHardware.c? I'm used to a 1:1 relationship between a .c module and .h include so having mainpanel.c have two includes to describe it is throwing me off.

 

If I take the third option (create function to return panel handle in mainpanel.c and call that from DAQHardware.c), do I need to include the auto-generated mainpanel.h from DAQHardware.c so I know the control constant names?

0 Kudos
Message 1 of 2
(4,106 Views)

CVI creates include files to declare controls and functions you design in  the UIR editor. Besides those functions,  you can create how many other functions you want provided you declare them somewhere. It's perfectly safe to to have them declared in a separate include file added to all the source file where you need to use those functions in. It's  the same as including userint.h or analysis.h

 

To answer your second question, yes: you need to add mainpanel.h file in every source file where you want to access user interface controls



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 2
(4,080 Views)